Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Easily and automatically cast common datatypes in JavaScript
JavaScript
tree: 5b6f66c107

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
tests
.gitignore
README.md
index.js
package.json

README.md

autocast

Easily and automatically cast common datatypes in JavaScript

Install

Install locally to use as a madule

npm install autocast

Usage

var autocast = require('autocast');

Example

var autocast = require('autocast'),
    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('true')
// x => true
x = autocast('false')
// x => false
x = autocast('normal string')
// x => 'normal string'

Tests

npm test

License

MIT Licensed

Something went wrong with that request. Please try again.