MCPcopy
hub / github.com/microsoft/SandDance / pivotKeys

Function pivotKeys

docs/tests/v2/es6/js/sanddance.js:91487–91503  ·  view source on GitHub ↗
(key, limit, pulse)

Source from the content-addressed store, hash-verified

91485
91486
91487function pivotKeys(key, limit, pulse) {
91488 var map = {},
91489 list = [];
91490 pulse.visit(pulse.SOURCE, function (t) {
91491 var k = key(t);
91492
91493 if (!map[k]) {
91494 map[k] = 1;
91495 list.push(k);
91496 }
91497 }); // TODO? Move this comparator to vega-util?
91498
91499 list.sort(function (u, v) {
91500 return (u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0;
91501 });
91502 return limit ? list.slice(0, limit) : list;
91503}
91504},{"./Aggregate":"aUqN","./util/AggregateOps":"Fivq","vega-util":"d61Z"}],"nThC":[function(require,module,exports) {
91505"use strict";
91506

Callers 1

aggregateParamsFunction · 0.70

Calls 1

keyFunction · 0.50

Tested by

no test coverage detected