Socket
Socket
Sign inDemoInstall

bind-obj-methods

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

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.


Version published
Weekly downloads
108K
decreased by-3.06%
Maintainers
1
Install size
3.98 kB
Created
Weekly downloads
 

Readme

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

Last updated on 25 Mar 2021

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc