primals
v0.1.1
Published
Parse stringified primitives
Downloads
3
Maintainers
Readme
primals
Parse stringified primitives (primitive types) into their JavaScript values
npm install primals --save
Usage
var primals = require('primals')
// Conversions
primals('undefined') // undefined
primals('null') // null
primals('true') // true
primals('false') // false
primals('47') // 47
primals('4e7') // 4e7
primals('NaN') // NaN
primals('Infinity') // Infinity
primals('-Infinity') // -Infinity
// Other values are returned unchanged
primals('example') // 'example'
primals('[]') // '[]'
primals([]) // []