Skip to content

A small, extensible data utility for cleansing string information into data.

License

Notifications You must be signed in to change notification settings

qwathi-ai/measured

Repository files navigation

Measured

Measured - Autocast information into rich data.

Autocast information into data points.


InstallationUsageDocumentationLicense

GitHub package.json version Coverage Status

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

License

Measured is licensed under a ISC License