@xylabs/array
TypeScript icon, indicating that this package has built-in type declarations

5.0.0 • Public • Published

@xylabs/array

logo

main-build npm-badge npm-downloads-badge jsdelivr-badge npm-license-badge codacy-badge codeclimate-badge snyk-badge socket-badge

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

Package Sidebar

Install

npm i @xylabs/array

Homepage

xylabs.com

Weekly Downloads

5,018

Version

5.0.0

License

LGPL-3.0-only

Unpacked Size

35.8 kB

Total Files

41

Last publish

Collaborators

  • joelbcarter
  • xyo
  • jordantrouw
  • rphansen91
  • jonesmac