bind-obj-methods

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

do not use this version, it is broken
Last updated 5 years ago by isaacs .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install bind-obj-methods 
SYNC missed versions from official npm registry.

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'

Current Tags

  • 3.0.0                                ...           latest (5 years ago)
  • 2.0.2                                ...           v2-legacy (5 years ago)

5 Versions

  • 2.0.2                                ...           5 years ago
  • 3.0.0                                ...           5 years ago
  • 2.0.1 [deprecated]           ...           5 years ago
  • 2.0.0                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (1)
  • tap ^15.0.0-2
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |