MCPcopy
hub / github.com/midrender/revideo / insert

Function insert

packages/2d/src/lib/utils/diff.ts:106–118  ·  view source on GitHub ↗
(item: TransformDiffItem<T>)

Source from the content-addressed store, hash-verified

104 cloner: (original: T) => T,
105): ApplyTransformResult<T> {
106 function insert(item: TransformDiffItem<T>) {
107 let idIndex = -1;
108 const index = item.before
109 ? current.findIndex(({id}) => {
110 if (id === item.before?.id) {
111 idIndex++;
112 if (idIndex === item.beforeIdIndex) return true;
113 }
114 return false;
115 })
116 : 0;
117 current.splice(index + 1, 0, item.current);
118 }
119
120 const result: ApplyTransformResult<T> = {
121 inserted: diff.inserted.map(item => ({

Callers 1

applyTransformDiffFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected