array.ts

view source

Declarations
#

4 declarations

EMPTY_ARRAY
#

remove_unordered
#

array.ts view source

(array: any[], index: number): void import {remove_unordered} from '@fuzdev/fuz_util/array.js';

Removes an element from array at index in an unordered manner.

array

type any[]

index

type number

returns

void

mutates

  • array — swaps element at index with last element, then pops

to_array
#

array.ts view source

<T>(value: T): T extends readonly any[] ? T : T[] import {to_array} from '@fuzdev/fuz_util/array.js';

Converts value to an array if it's not already.

value

type T

returns

T extends readonly any[] ? T : T[]

generics

to_array<T>
T

to_next
#

array.ts view source

<T extends ReadonlyArray<any>>(array: T): () => ArrayElement<T> import {to_next} from '@fuzdev/fuz_util/array.js';

Returns a function that returns the next item in the array in a linear sequence, looping back to index 0 when it reaches the end.

array

type T

returns

() => ArrayElement<T>

generics

to_next<T extends ReadonlyArray<any>>
T
constraint ReadonlyArray<any>

Depends on
#

Imported by
#