$ npm install autocast
Easily and automatically cast common datatypes in JavaScript
Install locally to use as a module
npm install autocast
var autocast = require('autocast');
var autocast = require('autocast'),
x;
x = autocast('5')
// x => 5
x = autocast('5.8')
// x => 5.8
x = autocast('5.8.8')
// x => '5.8.8'
x = autocast('null')
// x => null
x = autocast('true')
// x => true
x = autocast('false')
// x => false
x = autocast('normal string')
// x => 'normal string'
npm test
MIT Licensed
© 2010 - cnpmjs.org x YWFE | Home | YWFE