withChecksum
Appends a CRC-8 checksum to a string.
Type: transform
Parameters
- input (unknown): The input string to append a checksum to.
- chars (unknown): Number of checksum characters: 1 or 2 (default 2).
- sep (unknown): Separator between the input and checksum (default "-").
Returns
Type: string
The input string with appended checksum, or undefined if input is not a string.
Examples
javascript
withChecksum("DOC-001") // "DOC-001-2T"javascript
"CASE-2026-000184"|withChecksum // "CASE-2026-000184-0F"javascript
withChecksum("DOC-001", 1) // "DOC-001-H"