0.4.0 • Published 9 years ago

thunkify-or-promisify v0.4.0

Weekly downloads
54
License
MIT
Repository
github
Last release
9 years ago

Deprecated, use thenify or thenify-all

NPM version Build status Test coverage License Dependency status

thunkify-or-promisify

thunkify or promisify a callback style function

var wrapper = require('thunkify-or-promisify');

/**
 * @param origin  {function | object}
 * @param type    {string}           - optional ('thunk': thunkify, any other values: promisify)
 * @param ignores {array}            - optional (ignore some functional properties of object)
 *
 * wrapper(origin, type, ignores)
 */

// promisify
fn = wrapper(fn);
wrapper(object);

// thunkify
fn = wrapper(fn, 'thunk');
wrapper(object, 'thunk');

License

MIT