Skip to content

arrayutils

Michael Rojas edited this page Jun 24, 2021 · 1 revision

dastal - v5.0.0 / ArrayUtils

Namespace: ArrayUtils

Table of contents

Functions

Functions

isArray

isArray<T>(obj): obj is T[]

Check if a value is an Array or TypedArray.

Type parameters

Name Type
T T = any

Parameters

Name Type Description
obj unknown The value to check.

Returns

obj is T[]

true if an Array or TypedArray, otherwise false.

Defined in

src/utils/arrayUtils.ts:11


isTypedArray

Const isTypedArray<T>(obj): obj is T[]

Check if a value is a TypedArray.

See MDN for more details.

Type parameters

Name Type
T T = any

Parameters

Name Type Description
obj unknown The value to check.

Returns

obj is T[]

true if a TypedArray, otherwise false.

Defined in

src/utils/arrayUtils.ts:24


splice

splice<T>(array, start?, count?, elements?): T[]

Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

Contrary to Array.splice, this will not throw an error if too many new elements are given as arguments.

Type parameters

Name
T

Parameters

Name Type Description
array T[] The array to splice.
start? number The zero-based location in the array from which to start removing elements.
count? number The number of elements to remove.
elements? T[] The new elements to splice in.

Returns

T[]

  • An array containing the deleted elements.

Defined in

src/utils/arrayUtils.ts:42

Clone this wiki locally