MCPcopy Index your code
hub / github.com/microsoft/SandDance / SortedList

Function SortedList

docs/app/js/sanddance-app.js:116470–116491  ·  view source on GitHub ↗
(idFunc, source1, input)

Source from the content-addressed store, hash-verified

116468 }
116469});
116470function SortedList(idFunc, source1, input) {
116471 const $ = idFunc;
116472 let data = source1 || [], add2 = input || [], rem2 = {}, cnt = 0;
116473 return {
116474 add: (t)=>add2.push(t),
116475 remove: (t)=>rem2[$(t)] = ++cnt,
116476 size: ()=>data.length,
116477 data: (compare, resort)=>{
116478 if (cnt) {
116479 data = data.filter((t)=>!rem2[$(t)]);
116480 rem2 = {};
116481 cnt = 0;
116482 }
116483 if (resort && compare) data.sort(compare);
116484 if (add2.length) {
116485 data = compare ? (0, _vegaUtil.merge)(compare, data, add2.sort(compare)) : data.concat(add2);
116486 add2 = [];
116487 }
116488 return data;
116489 }
116490 };
116491}
116492/**
116493 * Collects all data tuples that pass through this operator.
116494 * @constructor

Callers 2

transformFunction · 0.70
groupFunction · 0.70

Calls 2

$Function · 0.70
filterMethod · 0.45

Tested by

no test coverage detected