/nhs-numbers

A simple NHS number validator for Node and browsers

Primary LanguageTypeScriptOtherNOASSERTION

NHS numbers

A simple NHS number generator & validator, following the process described in the NHS Data Dictionary.

Based on https://github.com/spikeheap/nhs-number-validator

Installation

yarn add nhs-numbers

Usage

import {
  generateNhsNumber,
  generateInvalidNhsNumbers,
  generateValidNhsNumbers,
  validateNhsNumber
} from "nhs-numbers"

// generate
const nhsNumber = generateNhsNumber()
const validNhsNumbers = generateValidNhsNumbers(10)
const invalidNhsNumbers = generateInvalidNhsNumbers(10)

// validate
const result = validateNhsNumber("1234567880")

Contributing

Setup

yarn

Test

yarn test