Skip to content

xueyongg/js-quantities

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Expand a string with quantities

Say you have the following string: "5GB", you can expand it to its numeric representation using this module.

It's actually very simple to use...

var parse_quantity = require('parse-quantities');


var measure = '5GB';
var qty = parse_quantity(measure);

console.log(qty);

Output:


{
    "scalar": 5,
    "baseScalar": 5000000000,
    "signature": 25600000000,
    "_conversionCache": {},
    "numerator: [ "<gigabyte>" ],
    denominator": [ "<1>" ],
    "initValue": "5GB",
    "_isBase": false,
    "_units": "GB"
}

About

Parse string for quantities

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%