Autocast information into data points.
Installation • Usage • Documentation • License
A small, extensible data utility for cleansing string `information` into data.Install via npm
npm install --save-exact @qwathi-ai/measured
const measured = require('@qwathi-ai/measured');
// Optional
measured.setoptions({
decimalseparator: [',', '.'],
dateformat: ['YYYY-MM-DD', 'DD-MM-YYYY'],
decimalplaces: 3
})
// Autocast the information.
const autocast = measured({
a: '',
b: 'false',
c: '35.3',
d: '14,9%',
e: '21-05-2020',
f: 'hello word',
g: ['4', 'the', 'love', '"true"', 'th']
})
assert(autocast.symbol === Symbol.for('dictionary'))
console.log(autocast.value) // =>
/*
{
a: undefined,
b: false,
c: 35.3,
d: 0.149,
e: '2020-05-21',
f: 'hello word',
g: [4, 'the', 'love', true, 'th']
}
*/
Complete api documentation can be found here
Measured is licensed under a ISC License