arktype icon indicating copy to clipboard operation
arktype copied to clipboard

`format.normalize`

Open Bas950 opened this issue 1 year ago • 0 comments

Add support for normalize format keyword.

As discussed with @ssalbdivad, this can be implemented in different ways.

Submodules

const nfc = type("format.normalize.nfc");
const nfd = type("format.normalize.nfd");
const nfkc = type("format.normalize.nfkc");
const nfkd = type("format.normalize.nfkd");

// And optionally a default
const normalize = type("format.normalize");
// This would use NFC as that is the JavaScript default

Generics

As described in https://github.com/arktypeio/arktype/issues/1054 it would require default values in generics so we can also add a default.

const nfc = type('format.normalize<"NFC">');
const nfd = type('format.normalize<"NFD">');
const nfkc = type('format.normalize<"NFKC">');
const nfkd = type('format.normalize<"NFKD">');
const normalize = type("format.normalize"); // format.normalize<T = "NFC">

Bas950 avatar Aug 04 '24 08:08 Bas950