node package manager
Stop writing boring code. Discover, share, and reuse within your team. Create a free org »

chainbuilder-lodash

chainbuilder-lodash Build Status

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 
    })
  ]
});