MCPcopy
hub / github.com/loggerhead/json4u / sort

Function sort

src/lib/compare/diff.ts:61–69  ·  view source on GitHub ↗
(diffs: Diff[])

Source from the content-addressed store, hash-verified

59 * @returns The sorted array of differences.
60 */
61export function sort(diffs: Diff[]): Diff[] {
62 return diffs.sort((a, b) => {
63 if (a.type !== b.type) {
64 return a.type === "del" ? -1 : 1;
65 } else {
66 return a.offset - b.offset;
67 }
68 });
69}

Callers 2

expectEqFunction · 0.90
classifyFunction · 0.85

Calls

no outgoing calls

Tested by 1

expectEqFunction · 0.72