@citrineos/util
Version:
The OCPP util module which supplies helpful utilities like cache and queue connectors, etc.
16 lines (15 loc) • 717 B
TypeScript
/**
* Calculate check digit for eMAID according to eMI³ specification
* Based on the algorithm described in "Check Digit Calculation for Contract-IDs"
*
* This implementation can detect five most frequent error types:
* 1. Single error: one character is wrong
* 2. Adjacent transposition: two adjacent characters are swapped
* 3. Twin error: two identical adjacent characters are both changed
* 4. Jump transposition: abc becomes cba
* 5. Jump twin error: aca becomes bcb
*
* @param emaidWithoutCheckDigit - The first 14 characters of the eMAID (without check digit)
* @returns The calculated check digit character
*/
export declare function calculateCheckDigit(emaidWithoutCheckDigit: string): string;