A set of JavaScript utilities that I keep having to write/re-write.
function truthy(x) { ... } // returns true if x is truthy (true, object, etc.)
function falsy(x) { ... } // returns true if x is falsey (null, undefined, false, etc.)
See:
- Falsy values - https://developer.mozilla.org/en-US/docs/Glossary/Falsy
- Truthy values - https://developer.mozilla.org/en-US/docs/Glossary/Truthy