advice.js

0.0.0 • Public • Published

advice.js

Build Status

Simple AOP library for both Node.js and browsers.

function base() {}
 
// compose a new function which calls a function after base returns
var fn = advice.after(base, function() {
  console.log('base was called');
});
 
 
var obj = {
  foo: function() {}
};
 
// redefine a method which calls a function after obj.foo returns
advice.after(obj, 'foo', function() {
  console.log('obj.foo was called');
});

Documentation

advice.before(base, fn)

advice.before(obj, method, fn)

advice.after(base, fn)

advice.after(obj, method, fn)

advice.around(base, fn)

advice.around(obj, method, fn)

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i advice.js

Weekly Downloads

0

Version

0.0.0

License

none

Last publish

Collaborators

  • nkzawa