Simple functional programming utility & programming helper tools
False & True checker
Why need this utility?
import { isFalse } from 'my-easy-fp'
const iamboolean = false;
if (!iamboolean) {
console.log('I am execute false-case');
}
if (isFalse(iamboolean)) {
console.log('I am execute false-case');
}
Empty checker
Why need this utility?
const iamempty: null | undefined = undefined;
if (iamempty === undefined || iamempty === null) {
console.log('i am empty');
}
if (isEmpty(iamempty)) {
console.log('i am empty');
}
Sleep
Why need this utility?
const ms = 1000;
await new Promise((resolve) => setTimeout(() => resolve(), ms));
await sleep(ms);