Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryanve/primals
Parse stringified JavaScript primitives
https://github.com/ryanve/primals
javascript json
Last synced: about 1 month 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 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-09T07:08:33.000Z (about 8 years ago)
- Last Synced: 2024-10-04T08:08:21.886Z (about 1 month 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)