Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hugomd/joi-currency-code
💰 Joi validation for ISO 4217 currency codes.
https://github.com/hugomd/joi-currency-code
custom extension joi plugin validation
Last synced: 3 months ago
JSON representation
💰 Joi validation for ISO 4217 currency codes.
- Host: GitHub
- URL: https://github.com/hugomd/joi-currency-code
- Owner: hugomd
- Created: 2017-06-06T00:57:21.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-08-30T19:16:25.000Z (5 months ago)
- Last Synced: 2024-10-29T15:33:55.047Z (3 months ago)
- Topics: custom, extension, joi, plugin, validation
- Language: JavaScript
- Homepage:
- Size: 461 KB
- Stars: 9
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# 💰 joi-currency-code
[![npm](https://img.shields.io/npm/v/joi-currency-code.svg?maxAge=2592000)](https://www.npmjs.com/package/joi-currency-code) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
> A Joi validator that validates whether a given input is a valid currency code, according to ISO 4217.
## Installation
```javascript
npm install joi-currency-code
```## Usage
```javascript
const Joi = require('joi').extend(require('joi-currency-code'));const schema = Joi.object({
code: Joi.string().currency()
});Joi.validate({
code: 'aud'
}, schema); // succeedsJoi.validate({
code: 'fake-currency'
}, schema); // fails with ValidationError
```## Contributing
* `git clone [email protected]: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
* [`is-currency`](https://github.com/hugomd/is-currency)
* [`is-currency-code`](https://github.com/hugomd/is-currency-code)
* [`is-currency-symbol`](https://github.com/hugomd/is-currency-symbol)