string-to-type

0.1.1 • Public • Published

string-to-type

Given a string variable, this module detects the if the string is a stringified boolean or numeric value, then converts the variable and returns it.

example

var typeDetectConvert = require('string-to-type')

console.log(typeDetectConvert("1234"))
// 1234

console.log(typeof typeDetectConvert("1234"))
// number

console.log(typeof typeDetectConvert("true"))
// boolean

license

MIT

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i string-to-type

    Weekly Downloads

    9

    Version

    0.1.1

    License

    MIT

    Last publish

    Collaborators

    • bloodyknuckles