Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

verhoeff-algorithm

npdevind267MIT1.0.0TypeScript support: included

A TypeScript implementation of the Verhoeff algorithm.

verhoeff, checksum, validation, algorithm, typescript

readme

Verhoeff Algorithm Validator

A simple TypeScript implementation of the Verhoeff algorithm for checksum validation.

Installation

You can install this package using npm:

npm install verhoeff-algorithm

Usage

Import the module

In TypeScript:

import { isValidVerhoeff } from "verhoeff-algorithm";

In JavaScript:

const { isValidVerhoeff } = require("verhoeff-algorithm");

Validate a number

const number = "12345";
if (isValidVerhoeff(number)) {
  console.log("Valid Verhoeff number");
} else {
  console.log("Invalid Verhoeff number");
}

How It Works

The Verhoeff algorithm is a checksum formula for error detection. It ensures that a given numeric value follows a specific checksum pattern. This package provides a function to verify whether a number passes the Verhoeff validation.

License

This project is licensed under the MIT License.

Author

Created by npdevind.