Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

chainbuilder-lodash

2.0.0 • Public • Published

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

install

npm i chainbuilder-lodash

Downloadsweekly downloads

11

version

2.0.0

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability