https://github.com/ryanve/primals
Parse stringified JavaScript primitives
https://github.com/ryanve/primals
javascript json
Last synced: 2 months ago
JSON representation
Parse stringified JavaScript primitives
- Host: GitHub
- URL: https://github.com/ryanve/primals
- Owner: ryanve
- License: mit
- Created: 2016-09-09T04:40:05.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-09T07:08:33.000Z (about 9 years ago)
- Last Synced: 2025-06-29T20:17:52.453Z (5 months ago)
- Topics: javascript, json
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/primals
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# primals
Parse stringified primitives (primitive types) into their JavaScript values
```sh
npm install primals --save
```
## Usage
```js
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](LICENSE)