🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

abind

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abind

Auto bind instance methods of classes.

1.0.5
latest
Version published
Weekly downloads
12K
123.95%
Maintainers
1
Weekly downloads
 
Created

abind

Build Status npm Version JS Standard

Auto bind instance methods of classes.

Installation

$ npm install abind --save

Usage

'use strict'

const abind = require('abind')

class Talker {
  constructor (name) {
    this.name = name
    abind(this)
  }

  sayHi () {
    return `Hi, i'm ${this.name}`
  }
}

let { sayHi } = new Talker('Tom')

console.log(sayHi()) // -> Hi, i'm Tom

Signature

abind(instance, options) -> Object

Params

NameTypeDescription
instanceObjectInstance to bind
optionsObjectOptional settings
options.protoObjectPrototype to bind
options.excludesstring[]Names to exclude

License

This software is released under the MIT License.

Keywords

FAQs

Package last updated on 05 Mar 2019

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