MCPcopy Create free account
hub / github.com/Kong/insomnia / patch

Function patch

packages/insomnia/src/sync/delta/patch.ts:3–15  ·  view source on GitHub ↗
(a: string, operations: Operation[])

Source from the content-addressed store, hash-verified

1import type { Operation } from './diff';
2
3export function patch(a: string, operations: Operation[]) {
4 let result = '';
5
6 for (const op of operations) {
7 if (op.type === 'COPY') {
8 result += a.slice(op.start, op.start + op.len);
9 } else if (op.type === 'INSERT') {
10 result += op.content;
11 }
12 }
13
14 return result;
15}

Callers 1

patch.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected