unary-with-optional-callback
1.0.0 • Public • Published unary-with-optional-callback
Creates a unary function with an optional transformer callback from a callable and a transformer fallback
Install
npm i unary-with-optional-callback
Usage
var unaryWithOptionalCallback = require('unary-with-optional-callback');
function transformableSqrt(transformer, x) {
return transformer(Math.sqrt(x));
}
var integerSqrt = unaryWithOptionalCallback(transformableSqrt, Math.floor);
integerSqrt(8);
integerSqrt(8, Math.ceil);
Package Sidebar
Install
npm i unary-with-optional-callback
Weekly Downloads