MCPcopy Create free account
hub / github.com/Effect-TS/effect / normalize

Function normalize

packages/effect/src/Path.ts:543–557  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

541const posixImpl = make({
542 resolve,
543 normalize(path) {
544 if (path.length === 0) return "."
545
546 const isAbsolute = path.charCodeAt(0) === 47 /*/*/
547 const trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/
548
549 // Normalize the path
550 path = normalizeStringPosix(path, !isAbsolute)
551
552 if (path.length === 0 && !isAbsolute) path = "."
553 if (path.length > 0 && trailingSeparator) path += "/"
554
555 if (isAbsolute) return "/" + path
556 return path
557 },
558
559 isAbsolute(path) {
560 return path.length > 0 && path.charCodeAt(0) === 47 /*/*/

Callers 3

templateLiteralParserFunction · 0.70
makeRestrictionsFunction · 0.70
parseSegmentFunction · 0.70

Calls 1

normalizeStringPosixFunction · 0.85

Tested by

no test coverage detected