0.1.3 • Published 4 years ago

@jamangile/measured v0.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

Autocast information into data points.


A simple, extensible data utility that auto casts information into data points.

Installation

Installed via npm

npm install @jamangile/measured

Usage

Use whenever you know very little about the incoming information. Measured will clean the data on the fly.

import measured from '@jamangile/measured';

// ** Optional**
// You can overwrite the default options.
measured.setoptions({
  decimalseparator: [',', '.'] // Defaults to just `.`
})

// autocast the information.
const autocast = measured({
  a: '',
  b: 'false',
  c: '35.3',
  d: '10,4%',
  e: '2020-05-21',
  f: 'hello word',
  g: ['list', 'of', 'things']
})

// use the `type` property to know what this has been cast to.
console.log(autocast.type) // .type = 'dictionary'

// use the `value` property to access the data.
console.log(10 * autocast.value.d) // 10 * 0.104
console.log(autocast.value.g.type) // .type = 'list'

Documentation

The complete documentation can be found here

Contributions

Please contribute in one of the following ways:

  • Give the project a :star: star if you like the work.
  • :eye: Watch the project for up-coming updates.

Contribution guidelines coming soon.

License

Measured is licensed under a ISC License