Package: effect
Module: String
Normalizes a string according to the specified Unicode normalization form.
Example (Normalizing Unicode strings)
import { pipe, String } from "effect"
import * as assert from "node:assert"
const str = "\u1E9B\u0323"
assert.deepStrictEqual(pipe(str, String.normalize()), "\u1E9B\u0323")
assert.deepStrictEqual(pipe(str, String.normalize("NFC")), "\u1E9B\u0323")
assert.deepStrictEqual(pipe(str, String.normalize("NFD")), "\u017F\u0323\u0307")
assert.deepStrictEqual(pipe(str, String.normalize("NFKC")), "\u1E69")
assert.deepStrictEqual(
pipe(str, String.normalize("NFKD")),
"\u0073\u0323\u0307"
)
Signature
declare const normalize: (form?: "NFC" | "NFD" | "NFKC" | "NFKD") => (self: string) => string
Since v2.0.0