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

Function normalize

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

Source from the content-addressed store, hash-verified

478 [TypeId]: TypeId,
479 resolve,
480 normalize(path) {
481 if (path.length === 0) return "."
482
483 const isAbsolute = path.charCodeAt(0) === 47 /*/*/
484 const trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/
485
486 // Normalize the path
487 path = normalizeStringPosix(path, !isAbsolute)
488
489 if (path.length === 0 && !isAbsolute) path = "."
490 if (path.length > 0 && trailingSeparator) path += "/"
491
492 if (isAbsolute) return "/" + path
493 return path
494 },
495
496 isAbsolute(path) {
497 return path.length > 0 && path.charCodeAt(0) === 47 /*/*/

Callers 2

makeRestrictionsFunction · 0.70
parseSegmentFunction · 0.70

Calls 1

normalizeStringPosixFunction · 0.85

Tested by

no test coverage detected