Friendly Types
This ultra-simple library contains just three functions which simplifies primitive types conversion.
Installation
$ npm install --save friendly-types
Usage
const toBoolean toNumber toString = ;// import { toBoolean, toNumber, toString } from "friendly-types"; ; // false; // false; // false; // true; // false; // true; // false ("0", "false", "off" and "no" strings are converted to false); // true; // true ; // 0; // 0; // 0; // 1; // -123.45; // error! ; // ""; // ""; // "false"; // "true"; // "0"; // "-123.45"
Need more examples? See tests.