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

Function encodePathChars

packages/effect/src/Path.ts:458–475  ·  view source on GitHub ↗
(filepath: string)

Source from the content-addressed store, hash-verified

456const tabRegExp = /\t/g
457
458function encodePathChars(filepath: string) {
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,

Callers 1

toFileUrlFunction · 0.85

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected