Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

duck-punch

rpflorence10MIT1.0.0

Duck punch objects with reckless abandon

aop

readme

Duck Punch

Duck punch objects with reckless abandon.

Example

var punch = require('duck-punch');

var baby = {
  poo: function(oz) {
    return 'pooped '+oz + 'oz';
  }
};

baby.poo(2);
// 'pooped 2oz'

punch(obj, 'poo', function(old, oz) {
  var old(oz) + ' of really stinky stuff';
});

obj.poo();
// 'pooped 2oz of really stinky stuff'