autocast

Easily and automatically cast common datatypes in JavaScript

autocast

Easily and automatically cast common datatypes in JavaScript

Install locally to use as a madule

npm install autocast
var autocast = require('autocast');
var autocast = require('autocast'),
    x;
 
= autocast('5')
// x => 5 
= autocast('5.8')
// x => 5.8 
= autocast('5.8.8')
// x => '5.8.8' 
= autocast('null')
// x => null 
= autocast('true')
// x => true 
= autocast('false')
// x => false 
= autocast('normal string')
// x => 'normal string' 
npm test

MIT Licensed