Skip to content
This repository has been archived by the owner on Sep 9, 2021. It is now read-only.

Latest commit

 

History

History
46 lines (35 loc) · 690 Bytes

README.md

File metadata and controls

46 lines (35 loc) · 690 Bytes

real-types

Converts strings to the corresponding types.

travis build

Originally written as a quick way to convert form input values to corresponding types.

Install

Install using npm

npm install real-types

Usage

import convert from 'real-types'

const example = {
    foo: 'false',
    bar: ['1', '5', '9'],
    next: {
        label: 'foo',
        value: '10'
    }
};

console.log(convert(example));

Above code will print:

{
    foo: false,
    bar: [1,5,9],
    next: {
        label: 'foo',
        value: 10
    }
};

License

MIT