🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

bind-obj-methods

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bind-obj-methods

Bind methods to an object from that object or some other source. Optionally specify a set of methods to skip over.

latest
Source
npmnpm
Version
3.0.0
Version published
Weekly downloads
270K
-2.18%
Maintainers
1
Weekly downloads
 
Created
Source

bind-obj-methods

Bind methods to an object from that object or some other source. Optionally specify a set of methods to skip over.

Also binds non-enumerable methods, retaining their non-enumerable-ness.

API

bindObjMethods(obj, [source], [omit])

Bind all the methods from source onto obj, skipping over anything in the omit list. omit can be either an array or an object of boolean values. source defaults to obj if not specified.

USAGE

var bindObjMethods = require('bind-obj-methods')

var obj = {
  method: () => this.foo,
  foo: 'bar'
}

var m = obj.method
m() // undefined

bindObjMethods(obj)
m = obj.method
m() // 'bar'

FAQs

Package last updated on 25 Mar 2021

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