Giter VIP home page Giter VIP logo

bind-obj-methods's Introduction

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'

bind-obj-methods's People

Contributors

coreyfarrell avatar isaacs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

coreyfarrell

bind-obj-methods's Issues

Triggers getter functions

This function triggers getter functions. I found this due to libtap creating the Snapshot object for the root test earlier than I expected. Turns out bindObj(this, Test.prototype, bound) is causing a read of tap.snapshotFile, thus unexpectedly initializing the snapshot during the constructor instead of on first use.

I think this module needs to be modified to read property descriptors and only process value based properties.

Ship v2.0.1 as v3.0.0

Hi @isaacs,

The v2.0.1 update broke a few pipelines that still tested on Node.js v6. Could you restore v2.0.0 as latest and ship v2.0.1 as v3.0.0? Thanks!

commit 45eedc2 changes broke old versions of node

  • bind-obj-methods is a dependency of tap.
  • tap has an engines requirement of >=v4
  • commit 45eedc2 made changes incompatible with <=10
  • The version was bumped from 2.0.0 to 2.0.1
  • tap is now broken older versions of node.

This change should have been a major version bump.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.