Skip to content

Repository files navigation

function-at

build statuscodecovCode Climate

Pass functions with adjusted arguments

Usage

require('function-at');functionthenable(name){if(!name)returnPromise.reject(newTypeError('name string required'));vargreeting='Hello, '+name+'!';returnPromise.resolve(greeting);}// Normal callbackfunctioncallback(error,result){console.log('calback ---------------');console.log(' error:',error);console.log(' result:',result);}thenable('Friday')// On fulfillment // set error to null.then(callback.atfirst(null))

Output:

calback ---------------
error: null
result: Hello, Friday!

Catch example:

// Given the thenable() and callback()// functions definitions...thenable()// On rejection // set result to empty string.catch(callback.atlast(''));

Catch output:

calback ---------------
error: [TypeError: name string required]
result: 

Releases

Packages

Used by

Contributors

Languages