Expand description
Node path module — both flavors.
A faithful port of Node’s lib/path.js (v26): the POSIX flavor (which is
what require('path') and path.posix yield on a POSIX host) and the
Windows flavor (path.win32 / require('path/win32')), sharing the same
normalize_string core. The algorithms mirror the JS line-for-line —
index arithmetic included — so edge cases (UNC roots, device roots, reserved
device names, the CVE-2024-36139 relative-drive guard, trailing-separator
retention) behave exactly as Node’s do rather than approximately.
Node scans paths by UTF-16 code unit; this port scans by char. Every
comparison is against ASCII (/, \, ., :, drive letters) and every
slice boundary is derived from those comparisons, so the produced strings
are identical — only the intermediate index values differ on astral input.
Enums§
- Flavor
- Which separator flavor a
pathcall runs under.