mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
normalize uses the unicode-normalization crate (pure Rust, the standard NFC/NFD/NFKC/NFKD tables); the stripped embed example grows from 3047304 to 3178872 bytes. Program strings are UTF-8, so isWellFormed is always true and toWellFormed returns its receiver. repeat and padStart report the reference's limit errors.
10 lines
683 B
JavaScript
10 lines
683 B
JavaScript
const out = []
|
|
out.push("\u0041\u030A".normalize(), "Å".normalize("NFD").length, "fi".normalize("NFKC"), "fi".normalize("NFKD"), "abc".normalize("NFC"))
|
|
try { "a".normalize("nope") } catch (e) { out.push(e.name, e.message) }
|
|
out.push("abc".isWellFormed(), "abc".toWellFormed())
|
|
out.push(String.raw({ raw: ["x", "y", "z"] }, 1), String.raw({ raw: { length: 2, 0: "p", 1: "q" } }, { toString() { return "!" } }))
|
|
try { String.raw({}) } catch (e) { out.push(e.name, e.message) }
|
|
try { "a".repeat(-1) } catch (e) { out.push(e.name, e.message) }
|
|
try { "a".padStart(2 ** 25) } catch (e) { out.push(e.name, e.message) }
|
|
out.push("a".split(undefined, 0), "a".split(undefined))
|
|
return out
|