MCPcopy
hub / github.com/Effect-TS/effect / normalize

Function normalize

packages/platform/src/internal/path.ts:237–251  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

235 [TypeId]: TypeId,
236 resolve,
237 normalize(path) {
238 if (path.length === 0) return "."
239
240 const isAbsolute = path.charCodeAt(0) === 47 /*/*/
241 const trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/
242
243 // Normalize the path
244 path = normalizeStringPosix(path, !isAbsolute)
245
246 if (path.length === 0 && !isAbsolute) path = "."
247 if (path.length > 0 && trailingSeparator) path += "/"
248
249 if (isAbsolute) return "/" + path
250 return path
251 },
252
253 isAbsolute(path) {
254 return path.length > 0 && path.charCodeAt(0) === 47 /*/*/

Callers

nothing calls this directly

Calls 1

normalizeStringPosixFunction · 0.85

Tested by

no test coverage detected