add-as-methods
Microutil to add bound functions to a JS object
Installation
npm install add-as-methods --save
Usage
addAsMethods(object, ...funcs)
object
an object to augment with some methodsfuncs
a list of named functions to add toobject
as methods. The magic is simply "passthis
as the first argument". Other arguments are also preserved (see example).
; { return fruitname === anotherFruitname;} { return fruitname === 'banana';} let awesomeFruit = name: 'banana' awesome: true;let yourFruit = name: 'apple' awesome: false; /* augment it */awesomeFruit = ; console;console;
License
MIT