mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-02 06:02:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
23
web/node_modules/compose-function/module/index.js
generated
vendored
Normal file
23
web/node_modules/compose-function/module/index.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
import arityN from 'arity-n';
|
||||
|
||||
|
||||
let compose2 = (f, g) => (...args) => f(g(...args));
|
||||
|
||||
export default function compose(...functions) {
|
||||
|
||||
const funcs = functions.filter(fn => typeof fn === 'function');
|
||||
|
||||
let lastIdx = funcs.length - 1;
|
||||
let arity = 0;
|
||||
|
||||
if (funcs.length <= 0) {
|
||||
throw new Error('No funcs passed');
|
||||
}
|
||||
|
||||
|
||||
if (lastIdx >= 0 && funcs[lastIdx]) {
|
||||
arity = funcs[lastIdx].length;
|
||||
}
|
||||
|
||||
return arityN(funcs.reduce(compose2), arity);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue