@xylabs/array


Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Reference
@xylabs/array
Functions
functions
containsAll
@xylabs/array
function containsAll<T>(source, target): boolean;
Type Parameters
T
T
Parameters
source
T[]
target
T[]
Returns
boolean
distinct
@xylabs/array
function distinct<T>(
value,
index,
array): boolean;
Type Parameters
T
T
Parameters
value
T
index
number
array
T[]
Returns
boolean
filterAs
@xylabs/array
function filterAs<In, Out>(x, predicate): NonNullable<Out>[];
Type Parameters
In
In
Out
Out
Parameters
x
In[]
predicate
(a) => Out
Returns
NonNullable<Out>[]
filterAsync
@xylabs/array
function filterAsync<T>(array, predicate): Promise<T[]>;
Returns the elements of an array that meet the condition specified in a callback function.
Type Parameters
T
T
Parameters
array
T[]
The array to filter.
predicate
(value, index, array) => Promise<boolean>
A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
Returns
Promise<T[]>
The elements of an array that meet the condition specified in a callback function.
findAs
@xylabs/array
function findAs<In, Out>(x, predicate): undefined | NonNullable<Out>;
Type Parameters
In
In
Out
Out
Parameters
x
In[]
predicate
(a) => Out
Returns
undefined | NonNullable<Out>
findLastAs
@xylabs/array
function findLastAs<In, Out>(x, predicate): undefined | NonNullable<Out>;
Type Parameters
In
In
Out
Out
Parameters
x
In[]
predicate
(a) => Out
Returns
undefined | NonNullable<Out>
flatten
@xylabs/array
function flatten<T>(a?, b?): T[];
Type Parameters
T
T
Parameters
a?
T | ConcatArray<T>
b?
T | ConcatArray<T>
Returns
T[]
uniq
@xylabs/array
function uniq<T>(arr): T[];
Type Parameters
T
T
Parameters
arr
T[]
Returns
T[]
uniqBy
@xylabs/array
function uniqBy<T, I>(arr, iteratee): T[];
Type Parameters
T
T
I
I
Parameters
arr
T[]
iteratee
(item) => I
Returns
T[]
Part of sdk-js
Maintainers
License
See the LICENSE file for license details
Credits
Made with 🔥 and ❄️ by XYLabs