MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / insertSorted

Function insertSorted

graph-ui/src/tours/tour-generator.ts:517–529  ·  view source on GitHub ↗

Insert into an already sorted array, keeping it sorted.

(sorted: string[], value: string)

Source from the content-addressed store, hash-verified

515
516/** Insert into an already sorted array, keeping it sorted. */
517function insertSorted(sorted: string[], value: string): void {
518 let low = 0;
519 let high = sorted.length;
520 while (low < high) {
521 const middle = (low + high) >> 1;
522 if (compareText(sorted[middle], value) < 0) {
523 low = middle + 1;
524 } else {
525 high = middle;
526 }
527 }
528 sorted.splice(low, 0, value);
529}
530
531/**
532 * At most `limit` files from an order, keeping its shape.

Callers 2

releaseFunction · 0.85
topsortFilesFunction · 0.85

Calls 1

compareTextFunction · 0.70

Tested by

no test coverage detected