JSPM

bind-obj-methods

3.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 526999
  • Score
    100M100P100Q193084F
  • License ISC

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

Package Exports

  • bind-obj-methods

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bind-obj-methods) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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'