WIP - add extractor, generate snippet_data
This commit is contained in:
20
node_modules/chain-function/index.js
generated
vendored
Normal file
20
node_modules/chain-function/index.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
module.exports = function chain(){
|
||||
var len = arguments.length
|
||||
var args = [];
|
||||
|
||||
for (var i = 0; i < len; i++)
|
||||
args[i] = arguments[i]
|
||||
|
||||
args = args.filter(function(fn){ return fn != null })
|
||||
|
||||
if (args.length === 0) return undefined
|
||||
if (args.length === 1) return args[0]
|
||||
|
||||
return args.reduce(function(current, next){
|
||||
return function chainedFunction() {
|
||||
current.apply(this, arguments);
|
||||
next.apply(this, arguments);
|
||||
};
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user