haybale

1.0.1 • Public • Published

haybale

decorate an object prototype with the methods of an object

use

var decorate = require("haybale");
 
 
// model prototype
var model = {
 
  name: "hello"
 
}
 
// object with methods
var obj = {
  run: function () {
    console.log("running");
  },
  end: function () {
    console.log("ending");
  }
};
 
 
decorate(model, obj);
 
model.run();
 
model.end();
 

api

haybale exposes a single function

decorate(fn, obj)

params

model: the object prototype to be decorated

obj: the object with which to decorate the model

Package Sidebar

Install

npm i haybale

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • filwisher