chainbuilder-lodash
v2.0.0
Published
Lodash mixin for chainbuilder.
Downloads
7
Maintainers
Readme
chainbuilder-lodash
A lodash mixin for chainbuilder.
Installation npm install chainbuilder chainbuilder-lodash --save
Usage
var chainBuilder = require('chainbuilder');
var myChain = chainBuilder({
methods: {
/* ... your methods ... */
},
mixins: [
require('chainbuilder-lodash')()
]
});
myChain(['one', 'two', 'three'])
.map(function (val) { return val + ' mississippi'; }) // < from lodash
.end(function (err, result) {
console.log(result); /* > ["one mississippi", "two mississippi", "three mississippi" */
});
including / excluding functions
You can provide 'include' and 'exclude' options to limit the methods mixed in. e.g:
module.exports = chainBuilder({
methods: {/* ... your methods ... */},
mixins: [
require('chainbuilder-lodash')({
include: ['map', 'reduce'] // only the map and reduce functions will be mixed in
})
]
});
module.exports = chainBuilder({
methods: {/* ... your methods ... */},
mixins: [
require('chainbuilder-lodash')({
exclude: ['map', 'reduce'] // everything except the map and reduce functions will be mixed in
})
]
});