Skip to content

napunapu/js-decval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-decval

Simple JavaScript decimal number validator.

Currently the decimal separator is a period (.).

Usage

validate(numberString[, maxIntegralCount[, fractionalCount]])

Examples

The function retuns a boolean, in the following cases a true. In the following example the library has been required 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);

Running tests

Prerequisites: Node.js (including npm)

Install dependencies:

npm install

And run tests:

make test

About

JavaScript decimal number validator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published