autocast
Easily and automatically cast common datatypes in JavaScript
Last updated 14 years ago by bahamas10 .
Repository · Original npm · Tarball · package.json
$ npm install autocast 
SYNC missed versions from official npm registry.

autocast

Easily and automatically cast common datatypes in JavaScript

Usage

Node.js

var autocast = require('autocast');

Web

<script src="autocast.min.js"></script>
<!-- // defines autocast() -->

Example

var autocast = require('autocast');
var x;

x = autocast('5')
// x => 5
x = autocast('5.8')
// x => 5.8
x = autocast('5.8.8')
// x => '5.8.8'
x = autocast('null')
// x => null
x = autocast('undefined')
// x => undefined
x = autocast('NaN')
// x => NaN
x = autocast('true')
// x => true
x = autocast('false')
// x => false
x = autocast('normal string')
// x => 'normal string'

Install

npm install autocast

Tests

npm test

License

MIT Licensed

Current Tags

  • 0.0.4                                ...           latest (14 years ago)

5 Versions

  • 0.0.4                                ...           14 years ago
  • 0.0.3                                ...           14 years ago
  • 0.0.2                                ...           14 years ago
  • 0.0.1                                ...           14 years ago
  • 0.0.0                                ...           14 years ago
Maintainers (1)
Downloads
Total 27
Today 0
This Week 4
This Month 15
Last Day 0
Last Week 9
Last Month 7
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE