Socket
Book a DemoInstallSign in
Socket

butt

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

butt

If only there was a way to pass along a callback with exactly as many arguments as necessary.

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

butt

If only there was a way to pass along a callback with exactly as many arguments as necessary.

You know how you like chaining asynchronous function calls but sometimes weird arguments get in the way of your waterfall series with unpredictable arguments?

How about attempting to parseInt in a map only to find out map spews three arguments? What if you could CONTROL THIS nonsense?

NO MORE!

npm install butt --save

Usage

Functional arguments giving you headaches?

Before
n.map(function (val) {
  return parseInt(val);
});
After
n.map(butt(parseInt, 1));

Works on .forEach or any functional array method as well! Classy.

Before
n.forEach(function (val) {
  console.log(val);
});
After
n.forEach(butt(console.log, 1));

Mongoose being weird?

Before
async.waterfall([
  function (next) {
    new User(model).save(function (err) {
      next(err);
    });
  },
  function (next) {
    // MOAR CODE
  }
])
After
async.waterfall([
  function (next) {
    new User(model).save(butt(next, 1));
  },
  function (next) {
    // MOAR CODE
  }
])

Why?

It had to be done. It is known.

License

MIT

FAQs

Package last updated on 29 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts