sorted-array

@afoot/sorted-array / Exports

@afoot/sorted-array

Table of contents

Classes

Interfaces

Type Aliases

Type Aliases

DataItem

Ƭ DataItem: number | string | DataObject | unknown[]

Base units of info that can be added to a sorted array.

Defined in

index.ts:13


DataObject

Ƭ DataObject: Record<string | number, any>

Any Object Literal.

Defined in

index.ts:11


DataSet

Ƭ DataSet: TypeArray<DataItem>

The module payload.

Defined in

index.ts:8


SortCallback

Ƭ SortCallback: (a: DataItem, b: DataItem) => number

Type declaration

▸ (a, b): number

Sorting algorithm.

Parameters
Name Type Description
a DataItem Comparator to sort against.
b DataItem Comparator to sort against.
Returns

number

One of [0,1,-1] to determine sort order.

Defined in

index.ts:20


SortedArrayParams

Ƭ SortedArrayParams: DataSet | SortedArrayConfig

Params passed into new instane.

Defined in

index.ts:22


TypeArray

Ƭ TypeArray<Type>: Type extends unknown ? Type[] : never

Generates DataSet by iterating over union types of DataItem, applying array type to each.

TypeScript will not allow you to mix types in the array.

Type parameters

Name
Type

Defined in

index.ts:6