Meet npm Pro: unlimited public & private packages + package-based permissions.Learn more »

unl

1.0.1 • Public • Published

Functional Branch

unl exports only one function that takes a test, a left, and a right function and return a combined one that will run left if test returns falsy and right otherwise

Example

const unless = require('unl');
 
const isOdd = x => x % 2;
 
const left = x => `${x} is not odd`;
const right = x => `${x} is not even`;
 
const fn = unless(isOdd, left, right);
 
console.log(fn(2)); // returns 2 is not odd
console.log(fn(1)); // returns 1 is not even

Install

npm i unl

DownloadsWeekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • avatar