Functional pipeline
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
export const comp = (...fs) => x0 => fs.reduceRight((x, f) => f(x), x0);
|
||||
export const flow = (...fs) => x0 => fs.reduce((x, f) => f(x), x0);
|
||||
export const pipe = (x0, ...fs) => fs.reduce((x, f) => f(x), x0);
|
||||
export const aflow = (f0, ...fs) => async (...args) => fs.reduce((x, f) => f(x), await f0(...args));
|
||||
|
||||
export function uniq(xs) {
|
||||
var seen = {};
|
||||
return xs.filter(x => seen.hasOwnProperty(x) ? false : (seen[x] = true));
|
||||
|
Reference in New Issue
Block a user