Typer
A small module that allows you to do simple type casting and detecting.
Installation
npm i --save typer
Usage
Usage is pretty simple. First, require typer and then use one of the documented methods.
.detect(value)
Detect the type of value
.
var typer = ; console; // floatconsole; // integerconsole; // booleanconsole; // datetime
You can find more examples in the tests.
.cast(value, type='smart')
Cast value
to type
.
var typer = ; console; // '23'console; // 23console; // 23.00console; // Mon, 22 Feb 2016 18:00:00 GMT