Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bahamas10/node-autocast
Easily and automatically cast common datatypes in JavaScript
https://github.com/bahamas10/node-autocast
Last synced: 2 months ago
JSON representation
Easily and automatically cast common datatypes in JavaScript
- Host: GitHub
- URL: https://github.com/bahamas10/node-autocast
- Owner: bahamas10
- Created: 2012-06-22T23:56:10.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-12-17T17:50:51.000Z (about 12 years ago)
- Last Synced: 2024-10-31T18:07:32.527Z (2 months ago)
- Language: JavaScript
- Size: 116 KB
- Stars: 20
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
autocast
========Easily and automatically cast common datatypes in JavaScript
Usage
-----Node.js
``` js
var autocast = require('autocast');
```Web
``` html
```
Example
-------``` js
> var autocast = require('autocast');
[Function: autocast]
> autocast('5')
5
> autocast('5.8')
5.8
> autocast('5.8.8')
'5.8.8'
> autocast('null')
null
> autocast('undefined')
undefined
> autocast('NaN')
NaN
> autocast('true')
true
> autocast('false')
false
> autocast('normal string')
'normal string'
> autocast('0xff')
255
> autocast('1e3')
1000
> autocast('0001')
1
```Install
------npm install autocast
Tests
-----npm test
License
-------MIT Licensed