Simple JavaScript decimal number validator.
Currently the decimal separator is a period (.
).
validate(numberString[, maxIntegralCount[, fractionalCount]])
The function retuns a boolean
, in the following cases a true
. In the following example the library has been require
d using Node.js's syntax:
var decval = require('../index');
var ok = decval.validate('123.4');
var ok = decval.validate('123.45');
var ok = decval.validate('123.45', 3);
var ok = decval.validate('123.45', 3, 2);
Prerequisites: Node.js (including npm
)
Install dependencies:
npm install
And run tests:
make test