MCPcopy Create free account
hub / github.com/tinyplex/tinybase / arrayIsSorted

Function arrayIsSorted

src/common/array.ts:32–39  ·  view source on GitHub ↗
(
  array: Value[],
  sorter: (value1: Value, value2: Value) => number,
)

Source from the content-addressed store, hash-verified

30 : value1 === value2;
31
32export const arrayIsSorted = <Value>(
33 array: Value[],
34 sorter: (value1: Value, value2: Value) => number,
35): boolean =>
36 arrayEvery(
37 array,
38 (value, index) => index == 0 || sorter(array[index - 1], value) <= 0,
39 );
40
41export const arraySort = <Value>(
42 array: Value[],

Callers 1

setIndexDefinitionFunction · 0.90

Calls 1

arrayEveryFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…