1.0.1 • Published 3 years ago

@socketkit/ajv-currency-code v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

ajv-currency-code

Adds a currency_code format to Ajv.

Install

npm i --save @socketkit/ajv-currency-code

Setup

import Ajv from 'ajv'
import currenyCode from '@socketkit/ajv-currency-code'
const ajv = new Ajv()
currencyCode(ajv)

Usage

When defining your JSON schema, use the format keyword with ther value set to currency_code. For example

{
  "type": "object",
  "properties": {
    "currency": {
      "type": "string",
      "format": "currency_code"
    }
  }
}