0.0.2 • Published 8 years ago

augment-with v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

augment-with

basic utility to augment a constructor

how

var augmentWith = require('augment-with');
var augmentWithArray = require('augment-with-array');


var Collection = augmentWith(
  augmentWithArray,
  function Collection(array) {
    this.push.apply(this, array);
  }
);

Collection.prototype.each = funcion each(fn) {
  this.forEach(function (value, i, self) {
    fn.call(this, i, value);
  }, this);
};

new Collection(['a', 'b', 'c']).each(function (i, value) {
  console.log(i, value);
});
0.0.2

8 years ago

0.0.1

8 years ago