MCPcopy
hub / github.com/millsp/ts-toolbelt / paths

Function paths

scripts/tools/regex-update-file.ts:123–143  ·  view source on GitHub ↗
(paths: string[])

Source from the content-addressed store, hash-verified

121}
122
123const paths = (paths: string[]) => {
124 let possibilities: string[] = []
125
126 paths.forEach((path) => {
127 possibilities = [
128 ...possibilities, // merge previous
129 ...path.split('/'). // split the path
130 // @ts-ignore
131 map((path, index, array) => { // get combination
132 return array.slice(0, index + 1)
133 }). // got combinations
134 map((splitPath, index, splitPaths) => { // put it back as path
135 if (index < splitPaths.length - 1) // add regex `$` for all
136 return `${splitPath.join('/')}/$` // merge string back
137 return splitPath.join('/') // but not the last one
138 }),
139 ]
140 })
141
142 return possibilities
143}
144
145const replace = (
146 path: string,

Callers 1

replaceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…