Wondering what’s next for npm?Check out our public roadmap! »

validity-currency

1.1.2 • Public • Published

validity-currency

build status Coverage Status

Validity style validator which validates a float with currency symbols

Installation

npm install validity-currency

Usage

Below is a simple example for usage with schemata:

 
var validity = require('validity')
  , schemata = require('schemata')
  , save = require('save')
  , createValidator = require('validity-currency')
 
var schema = schemata(
    { state:
      { type: String
      , validators: { all: [ createValidator() ] }
      }
    })

API

var validate = createValidator([ errorMessage ])

Create a validate function.

validate(String:key, String:keyDisplayName, Object:object, Function:cb)

This is a validity compatible function, which in turn is used by schemata for schema validation.

The callback signature cb(err, errorMessage).

err is an Error object if something bad happened and null otherwise. errorMessage is a String if a validation error happened and undefined otherwise.

Install

npm i validity-currency

DownloadsWeekly Downloads

8

Version

1.1.2

License

ISC

Last publish

Collaborators

  • avatar