@stacksjs/ts-validation
Version:
A simple TypeScript starter kit using Bun.
29 lines • 1.07 kB
TypeScript
/**
* Algorithmic validation functions
* May be used as is or implemented in the workflow of other validators.
*/
/*
* ISO 7064 validation function
* Called with a string of numbers (incl. check digit)
* to validate according to ISO 7064 (MOD 11, 10).
*/
export declare function iso7064Check(str: string): boolean;
/*
* Luhn (mod 10) validation function
* Called with a string of numbers (incl. check digit)
* to validate according to the Luhn algorithm.
*/
export declare function luhnCheck(str: string): boolean;
/*
* Reverse TIN multiplication and summation helper function
* Called with an array of single-digit integers and a base multiplier
* to calculate the sum of the digits multiplied in reverse.
* Normally used in variations of MOD 11 algorithmic checks.
*/
export declare function reverseMultiplyAndSum(digits: number[], base: number): number;
/*
* Verhoeff validation helper function
* Called with a string of numbers
* to validate according to the Verhoeff algorithm.
*/
export declare function verhoeffCheck(str: string): boolean;