Skip to main content
Deno 2 is finally here πŸŽ‰οΈ
Learn more
Module

x/libauth/src/lib/format/utf8.ts>lossyNormalize

An ultra-lightweight, zero-dependency JavaScript library for Bitcoin Cash, Bitcoin, and Bitauth applications.
Latest
variable lossyNormalize
import { lossyNormalize } from "https://deno.land/x/libauth@v2.0.0-alpha.9/src/lib/format/utf8.ts";

Normalize a string using Unicode Normalization Form KC (NFKC): compatibility decomposition, followed by canonical composition. NFKC is the preferred form for applications in which disambiguation between characters is critical. In Libauth, all message formats designed for transmission between trust centers are NFKC-normalized to hinder exploits in which lookalike characters are used to deceive counterparties.

E.g.:

console.log(lossyNormalize('fitπŸš€πŸ‘«πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦')); // 'fitπŸš€πŸ‘«πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦'

type

(utf8: string) => unknown