https://github.com/confuser/node-validity-currency
Validity style validator which validates a float with currency symbols
https://github.com/confuser/node-validity-currency
Last synced: 9 months ago
JSON representation
Validity style validator which validates a float with currency symbols
- Host: GitHub
- URL: https://github.com/confuser/node-validity-currency
- Owner: confuser
- License: isc
- Created: 2015-05-09T16:07:03.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-08-11T04:31:58.000Z (almost 9 years ago)
- Last Synced: 2025-09-01T02:42:35.055Z (10 months ago)
- Language: JavaScript
- Size: 148 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# validity-currency
[](http://travis-ci.org/confuser/node-validity-currency)
[](https://coveralls.io/r/confuser/node-validity-currency?branch=master)
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:
```js
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.