Awesome
useware
Accept Arguments object or multiple arguments that can be any value, including deeply nested arrays. Flatten the arguments/values then filter them to be only functions.
Useful for.use
methods.
Install
npm i useware --save
npm test
Usage
For more use-cases see the tests
const useware = require('useware')
function fixtureArguments () {
return useware(arguments)
}
function fixtureMultiple () {
return useware.apply(this, arguments)
}
function fn1 () {}
function fn2 () {}
function fn3 () {}
fixtureArguments(fn1, [1, [2, 3, fn2]], {foo: 'bar'}, [fn3, [4, 5]])
//=> [fn1, fn2, fn3]
fixtureMultiple([1, fn1, [2, [fn3, [4, 5]], fn2]], fn1, [6, [fn3, 7, 'a']])
//=> [fn1, fn3, fn2, fn1, fn3]
Note that functions are not uniqueified
Related
- benz: Compose your control flow with absolute elegance. Support async/await, callbacks, thunks, generators, promises, observables, child… more
- composer: Boilerplate for creating a node.js application based on Template, vinyl and orchestrator. This consists of… more
- generate: Project generator, for node.js.
- vez: Middleware composition at new level. Ultimate alternative to
ware
,plugins
,koa-compose
andcomposition
packages. Allows… more - verb: Documentation generator for GitHub projects. Extremely powerful, easy to use, can generate anything from API… more
- useware-context: Much like
useware
but with the ability to bind given context to each function.
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.