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

Function encodePathChars

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

Source from the content-addressed store, hash-verified

520const tabRegExp = /\t/g
521
522function encodePathChars(filepath: string) {
523 if (filepath.includes("%")) {
524 filepath = filepath.replace(percentRegExp, "%25")
525 }
526 if (filepath.includes("\\")) {
527 filepath = filepath.replace(backslashRegExp, "%5C")
528 }
529 if (filepath.includes("\n")) {
530 filepath = filepath.replace(newlineRegExp, "%0A")
531 }
532 if (filepath.includes("\r")) {
533 filepath = filepath.replace(carriageReturnRegExp, "%0D")
534 }
535 if (filepath.includes("\t")) {
536 filepath = filepath.replace(tabRegExp, "%09")
537 }
538 return filepath
539}
540
541const posixImpl = make({
542 resolve,

Callers 1

toFileUrlFunction · 0.85

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected