MCPcopy Create free account
hub / github.com/pomber/code-surfer / generateIds

Function generateIds

packs/step-parser/src/differ.ts:49–65  ·  view source on GitHub ↗
(
  lineIds: number[],
  afterId: number = 0,
  count: number
)

Source from the content-addressed store, hash-verified

47}
48
49export function generateIds(
50 lineIds: number[],
51 afterId: number = 0,
52 count: number
53) {
54 const afterIndex = lineIds.indexOf(afterId);
55 const beforeIndex = afterIndex + 1;
56 const aid = afterId || 0;
57 const bid = lineIds[beforeIndex] || 1;
58
59 const newIds = Array(count)
60 .fill(0)
61 .map((_, i) => aid + ((bid - aid) * (i + 1)) / (count + 1));
62
63 lineIds.splice(afterIndex + 1, 0, ...newIds);
64 return newIds;
65}
66
67function getStepIds(
68 lineIds: number[],

Callers 2

differ.test.tsFile · 0.90
getStepIdsFunction · 0.85

Calls 1

mapMethod · 0.45

Tested by

no test coverage detected