0.0.1 • Published 11 years ago

validate-number v0.0.1

Weekly downloads
2
License
-
Repository
github
Last release
11 years ago

Validate Number

Strip any extranous price characters such as $ and make sure there is still a valid number

Installation

npm install -S validate-number

Usage

When using with a valid number, you will get the number back without any extra characters

var validateNumber = require('validateNumber')
var extract = '-$1.99'
var price = validateNumber(extract)
console.log('price %s', price)

When using with a invalid number, you will get back null

var validateNumber = require('validateNumber')
var extract = '-$foobar'
var price = validateNumber(extract) // price will be null
console.log('price %s', price)