ahv13-validator
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

js-ahv13

npm version ci release

About

Helps you to check ahv13 numbers (swiss social security numbers) for their validity. See also this article (in german) for more information about the form.

Installation

To install using npm:

npm install --save ahv13-validator

If you are using yarn:

yarn add ahv13-validator

Usage

The SSN can be passed with or without dots.

import { AHV13 } from 'ahv13-validator';

const ahv13validator = new AHV13();
const isValid = ahv13validator.isValid('756.9217.0769.85');

console.log('valid', isValid)

console.log('5==',ahv13.checkSum('756.9217.0769.8'));
console.log('true==',ahv13.isValid('756.9217.0769.85'));

Contributing

If you want to improve one of these images, your will need the following software installed on your system:

  • node (10 or higher) with npm

You can then install the dependencies by running npm ci.

Test the code

Code can be tested using Jest by running npm run test.

You can use npm run watch:test to watch for files and run the test on every change.

Build

Project can be transpiled from TypeScript to JavaScript by running npm run build.

You can use npm run watch:build to watch for files and build on every change.

Build the documentation

Documentation can be build with TypeDoc by running npm run doc.

You can use npm run watch:doc to watch for files and build the documentation on every change.

Note: This mode will only detect changes to files watched by the TypeScript compiler. Changes to other files (README.md) will not cause a rebuild.

Publish the documenation

Documentation can be published on GitHub Pages by running npm run doc && npm run doc:publish.

Testing GitHub Actions locally

GitHub Actions pipeline can be run locally using act.

Once installed just run act to run the pipeline locally.

External links

Here are a few extra links documenting how swiss social security number are checked:

KUDOS

Made with contrib.rocks.

Readme

Keywords

Package Sidebar

Install

npm i ahv13-validator

Weekly Downloads

123

Version

2.0.1

License

ISC

Unpacked Size

33.3 kB

Total Files

15

Last publish

Collaborators

  • longstone