Socket
Book a DemoInstallSign in
Socket

bind-fast

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bind-fast

Replacement for native bind() which does not optimize well

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

bind-fast

Bind methods fast without deoptimized native bind().

When you want to use bind but you do not want it to be deoptimized

If you keep writing code like this:

    this.on('eventName', function eventHandler() {
        this.a = 1;
        this.doThing();
    }.bind(this));

But are upset with about the tenth of the performance compared to the use of a capture closure reference to this in Node 0.10.x, 0.12.x and iojs then this module is for you!

Now just:

    var bindFast = require('bind-fast');
    this.on('eventName', bindFast(function eventHandler() {
        this.a = 1;
        this.doThing();
    }, this));

Also supports bound arguments like native bind.

Installation

npm install bind-fast

Tests

npm test

MIT Licensed

Keywords

utility

FAQs

Package last updated on 06 Mar 2015

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.