(form?: "NFC" | "NFD" | "NFKC" | "NFKD"): (self: string) => stringNormalizes 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"
)transforming
Source effect/String.ts:7521 lines
export const const normalize: (
form?: "NFC" | "NFD" | "NFKC" | "NFKD"
) => (self: string) => 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"
)
normalize = (form: | "NFC"
| "NFD"
| "NFKC"
| "NFKD"
| undefined
form?: "NFC" | "NFD" | "NFKC" | "NFKD") => (self: stringself: string): string => self: stringself.String.normalize(form?: string): string (+1 overload)Returns the String value result of normalizing the string into the normalization form
named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
normalize(form: | "NFC"
| "NFD"
| "NFKC"
| "NFKD"
| undefined
form)