@bemedev/boolean-recursive
v0.0.3
Published
Better write booleans functions recursively
Downloads
13
Readme
Recursively build boolean function with or/and
Example :
describe('#1 => Or', () => {
const fn1 = recursive({
or: [checkBool, checkNumber],
});
const useTests = createTests(fn1);
useTests(
['No objects', [], false],
['One string', ['str'], false],
['One boolean', [false], true],
['One number', [45], true],
['One simple object', [{ age: 54, login: 'login' }], false],
);
});
describe('#2 => And/Array', () => {
const fn1 = recursive(checkDefined, checkNumber);
const useTests = createTests(fn1);
useTests(
['No objects', [], false],
['One string', ['str'], false],
['One boolean', [false], false],
['One number', [45], true],
['One simple object', [{ age: 54, login: 'login' }], false],
);
});
//NB : We add async functions
import asyncRecursive from '@bemedev/boolean-recursive/lib/async';