npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nhs-number-validator

v1.1.1

Published

Validate NHS numbers in various guises

Downloads

7,730

Readme

NHS number validator (JS)

Build Status

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

Installation

NPM
npm install --save nhs-number-validator
Bower
bower install --save nhs-number-validator

Usage

Command line / terminal

To run the interactive validation tool, install the NPM module globally:

npm install -g nhs-number-validator

and nhs-number-validator will be added to your path:

$ nhs-number-validator
Enter NHS numbers to validate, Ctrl-D to exit
> 123
*INVALID
> 2983396339
 VALID

You can also install the tool for a single project, and just reference the executable in your project:

npm install nhs-number-validator
./node_modules/.bin/nhs-number-validator
# or
`npm bin`/nhs-number-validator
Node/Browserify

For environments supporting require/exports:

var validator = require('nhs-number-validator');

validator.validate('2983396339') // => true
validator.validate('test') // => false
Browsers

Any environment which exposes window will have the nhsNumberValidator variable attached when index.js is loaded, e.g.:

<script src="./bower_components/nhs-number-validator/index.js"></script>
<script>
  var validator = window.nhsNumberValidator
  validator.validate('2983396339') // => true
  validator.validate('test') // => false

  // or just use it directly if you prefer:
  window.nhsNumberValidator.validate('2983396339') // => true

  // you don't even need `window`:
  nhsNumberValidator.validate('2983396339') // => true
</script>

Contributing

Pull requests, issues, and questions are all welcome.

Some useful commands:

  • npm test: run the test suite.
  • npm run test-watch --silent: watch for changes and run the test suite each time.
  • npm run lint --silent: run the code linter.
  • npm run cli: run the validator CLI.

NPM is overly verbose at the moment, hence the additional --silent to suppress the unnecessary noise.

Creating a release

Making a release is pretty straightforward:

VERSION_NUMBER=1.1.0

git checkout master && git pull
git checkout develop && git pull

git flow release start $VERSION_NUMBER

# Bump the version in package.json now!
jq ".version = \"${VERSION_NUMBER}\"" package.json > package.json.new && mv package.json.new package.json
jq ".version = \"${VERSION_NUMBER}\"" bower.json > bower.json.new && mv bower.json.new bower.json
git add package.json
git commit -m "Update package version number to $VERSION_NUMBER"

# The following command requires user input
git flow release finish $VERSION_NUMBER

git checkout master && git push
git checkout develop && git push
git push --tags

git checkout master
hub release create -m "$VERSION_NUMBER" $VERSION_NUMBER
npm publish
# Bower is published automatically using Git tags, so don't worry about that
git checkout develop