Skip to content

ryanve/primals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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([]) // []

License

MIT