Skip to content

Latest commit

History

History
43 lines (30 loc) 路 1.13 KB

readme.md

File metadata and controls

43 lines (30 loc) 路 1.13 KB

馃挵 joi-currency-code

npm XO code style

A Joi validator that validates whether a given input is a valid currency code, according to ISO 4217.

Installation

npm install joi-currency-code

Usage

const Joi = require('joi').extend(require('joi-currency-code'));

const schema = Joi.object({
  code: Joi.string().currency()
});

Joi.validate({
  code: 'aud'
}, schema); // succeeds

Joi.validate({
  code: 'fake-currency'
}, schema); // fails with ValidationError

Contributing

  • git clone git@github.com:hugomd/joi-currency-code.git
  • npm install
  • Make your changes
  • Open a pull request and ask for review 鉁岋笍
  • Optional: use emoji in your commits 馃敟

Related Repositories