https://github.com/anonrig/ajv-swedish-ssn
AJV plugin for checking Swedish SSN validity
https://github.com/anonrig/ajv-swedish-ssn
Last synced: 3 months ago
JSON representation
AJV plugin for checking Swedish SSN validity
- Host: GitHub
- URL: https://github.com/anonrig/ajv-swedish-ssn
- Owner: anonrig
- Created: 2021-07-23T07:49:53.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-07-23T07:56:41.000Z (almost 5 years ago)
- Last Synced: 2025-09-03T03:53:23.055Z (10 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ajv-swedish-ssn
Adds a `swedish-ssn` format to [Ajv](https://ajv.js.org).
## Install
```bash
npm i --save ajv-swedish-ssn
```
## Setup
```javascript
import Ajv from 'ajv'
import ssnValidator from 'ajv-swedish-ssn'
const ajv = new Ajv()
ssnValidator(ajv)
```
## Usage
When defining your JSON schema, use the `format` keyword with ther value set to `swedish-ssn`. For example
```json
{
"type": "object",
"properties": {
"ssn": {
"type": "string",
"format": "swedish-ssn"
}
}
}
```