MCPcopy
hub / github.com/chartjs/Chart.js / _lookupByKey

Function _lookupByKey

src/helpers/helpers.collection.ts:50–61  ·  view source on GitHub ↗
(
  table: Record<string, number>[],
  key: string,
  value: number,
  last?: boolean
)

Source from the content-addressed store, hash-verified

48 * @private
49 */
50export const _lookupByKey = (
51 table: Record<string, number>[],
52 key: string,
53 value: number,
54 last?: boolean
55) =>
56 _lookup(table, value, last
57 ? index => {
58 const ti = table[index][key];
59 return ti < value || ti === value && table[index + 1][key] === value;
60 }
61 : index => table[index][key] < value);
62
63/**
64 * Reverse binary search

Calls 1

_lookupFunction · 0.85

Tested by

no test coverage detected