MCPcopy Create free account
hub / github.com/kpdecker/jsdiff / addToPath

Method addToPath

src/diff/base.ts:215–234  ·  view source on GitHub ↗
(
    path: Path,
    added: boolean,
    removed: boolean,
    oldPosInc: number,
    options: AllDiffOptions
  )

Source from the content-addressed store, hash-verified

213 }
214
215 private addToPath(
216 path: Path,
217 added: boolean,
218 removed: boolean,
219 oldPosInc: number,
220 options: AllDiffOptions
221 ): Path {
222 const last = path.lastComponent;
223 if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
224 return {
225 oldPos: path.oldPos + oldPosInc,
226 lastComponent: {count: last.count + 1, added: added, removed: removed, previousComponent: last.previousComponent }
227 };
228 } else {
229 return {
230 oldPos: path.oldPos + oldPosInc,
231 lastComponent: {count: 1, added: added, removed: removed, previousComponent: last }
232 };
233 }
234 }
235
236 private extractCommon(
237 basePath: Path,

Callers 1

execEditLengthMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected