MCPcopy Create free account
hub / github.com/effect-app/libs / encodePathChars

Function encodePathChars

repos/effect/packages/effect/src/Path.ts:461–478  ·  view source on GitHub ↗
(filepath: string)

Source from the content-addressed store, hash-verified

459 if (filepath.includes("%")) {
460 filepath = filepath.replace(percentRegExp, "%25")
461 }
462 if (filepath.includes("\\")) {
463 filepath = filepath.replace(backslashRegExp, "%5C")
464 }
465 if (filepath.includes("\n")) {
466 filepath = filepath.replace(newlineRegExp, "%0A")
467 }
468 if (filepath.includes("\r")) {
469 filepath = filepath.replace(carriageReturnRegExp, "%0D")
470 }
471 if (filepath.includes("\t")) {
472 filepath = filepath.replace(tabRegExp, "%09")
473 }
474 return filepath
475}
476
477const posixImpl = Path.of({
478 [TypeId]: TypeId,
479 resolve,
480 normalize(path) {
481 if (path.length === 0) return "."

Callers 1

toFileUrlFunction · 0.85

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…