physical-parser
v0.4.0
Published
Try to parse a string containing physical data like bp, mp
Downloads
660
Readme
physical-parser
Try to parse a string containing physical data like bp, mp.
Installation
$ npm i physical-parser
Usage
import { parseBoilingPoint, parseDensity, parseRefactiveIndex, parseNumbersUnits } from 'physical-parser';
let bp = parseBoilingPoint('100-120 @ 50 mmHg', {
temperature: {
defaultUnits: '°C'
}
pressure: {
defaultValue: 760,
defaultUnits: 'mmHg'
}
})
// bp: {temperature: {low: 100, high: 120, units: '°C'}, pressure: {low: 50, units: 'mmHg'}};
let density = parseDensity('1.5-1.51, t=25', {
value: {
defaultUnits: 'g/mL'
},
temperature: {
defaultUnits: '°C'
}
})
// density: {low: 1.5, high: 1.51, units: 'g/mL'}