Socket
Socket
Sign inDemoInstall

advice.js

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

advice.js

Simple AOP module


Version published
Maintainers
1
Weekly downloads
1
Install size
5.45 kB

Weekly downloads

Readme

Source

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

FAQs

Last updated on 18 Mar 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc