Converts strings to the corresponding types.
Originally written as a quick way to convert form input values to corresponding types.
Install using npm
npm install real-types
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
}
};
MIT