- MCP
- blame on this site's /mcp
- CLI
- abso blame worker/project/pathkey.ts --json
- JSON
- /christopher/abso-core/blame/worker/project/pathkey.ts?format=json
24 linesFirst import 100%Last change First import in version 0,
24 lines from 1 change in 1 version.
2// two spellings are one file when their keys are equal. It's Unicode's
3// canonical caseless match, used only to compare, never to rename: the
4// canonical decomposition (NFD), case folding, then NFD again. JavaScript has
5// no case-folding call, so upper-then-lower case stands in for it; unlike
6// lower case alone, it folds ß to ss as case folding does.
7//
8// The engine (V8 on Workers) and the client (Node) must build the same key,
9// so the client imports this file rather than writing its own. Both take
10// their Unicode data from their ICU; `unicodeVersion` says which, and a
11// mismatch can only matter for characters assigned after the older one.
13export function pathKey(path: string): string {
14 return path.normalize("NFD").toUpperCase().toLowerCase().normalize("NFD");
15}
17/** Whether a path is in composed form (NFC), the form most tools on Windows and Linux expect. */
18export function isComposed(path: string): boolean {
19 return path === path.normalize("NFC");
20}
22/** The Unicode version this runtime's data is from, where the runtime says. */
23export const unicodeVersion: string | undefined = (globalThis as { process?: { versions?: { unicode?: string } } })
24 .process?.versions?.unicode;