1.0.3 • Published 8 years ago

aku v1.0.3

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

aku

Last version Build Status Dependency status Dev Dependencies Status NPM Status Donate

Guardian Spirit. It Interceps a function and exec a handler based on the result.

Bind a handler to exec under error and bind another for non error. Simple!

Similar to jif but for functions.

Install

$ npm install aku --save

API

We distinguish between sync or async methods:

As you can see the library expose the async method by default.

fn

Required Type: function

Input sync/async function to be handled.

handler

Required Type: function

Handle that will be hooked under non error result.

errHandler

Type: function Defaults: noop

Handle that will be hooked under error result.

As you can see it is an optional handled.

If you provided a sync method, then it throws an error after errHandler execution.

License

MIT © Kiko Beats