Number abbreviation or for short Numab is a simple module for parsing string numbers.
With npm do
$ npm install numab
var numab = require('numab');
numab.parse("2.5"); // => 2.5
numab.parse("2.5k"); // => 2500
numab.parse("2.5M"); // => 2500000
Accepts a string of a number that is formatted in a "humanized" manner and converts it to a proper number.
numab.dehumanize("10,010"); // => 10010
numab.dehumanize("10,010.50"); // => 10010.50
The module can create instances for different local configurations.
var numab = require("numab");
var numabInstance = numab.createInstace();
numab.parse // => [Function: parse]
numabInstance.parse // => [Function: parse]
var numab = require('numab');
numab.parse("2.5k"); // => 2500
numab.parse("2,5k"); // => NaN
numab.config({separator: ","});
numab.parse("2,5k"); // => 2500
numab.config({separator: "," , deliminer: "."});
numab.dehumanize("1,100.52")
var configObj = {separator: ","};
var numabInstance = numab.createInstace();
numabIntance.config(configObj);
// or
var numabInstance = numab.createInstace(configObj);