Launch Week Day 3: Introducing Organization Notifications in Socket.Learn More
Socket
Book a DemoSign in
Socket

@xylabs/array

Package Overview
Dependencies
Maintainers
5
Versions
513
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xylabs/array

Base functionality used throughout XY Labs TypeScript/JavaScript libraries

latest
Source
npmnpm
Version
5.0.100
Version published
Weekly downloads
4.2K
43.39%
Maintainers
5
Weekly downloads
 
Created
Source

@xylabs/array

npm license

Base functionality used throughout XY Labs TypeScript/JavaScript libraries

Install

Using npm:

npm install {{name}}

Using yarn:

yarn add {{name}}

Using pnpm:

pnpm add {{name}}

Using bun:

bun add {{name}}

License

See the LICENSE file for license rights and limitations (LGPL-3.0-only).

Reference

packages

array

### .temp-typedoc

  ### functions

    ### <a id="containsAll"></a>containsAll

@xylabs/array

function containsAll<T>(source, target): boolean;

Checks whether the source array contains every element in the target array.

Type Parameters

T

T

Parameters

source

T[]

The array to search within

target

T[]

The elements that must all be present

Returns

boolean

True if every target element exists in source

    ### <a id="distinct"></a>distinct

@xylabs/array

function distinct<T>(
   value, 
   index, 
   array): boolean;

Array filter callback that removes duplicate values, with correct NaN handling. Use with array.filter(distinct).

Type Parameters

T

T

Parameters

value

T

index

number

array

T[]

Returns

boolean

    ### <a id="filterAs"></a>filterAs

@xylabs/array

function filterAs<In, Out>(x, predicate): NonNullable<Out>[];

Maps each element using the predicate and filters out nullish results.

Type Parameters

In

In

Out

Out

Parameters

x

In[]

The input array

predicate

(a) => Out

Transform function applied to each element

Returns

NonNullable<Out>[]

Array of non-nullish transformed values

    ### <a id="filterAsync"></a>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.

    ### <a id="findAs"></a>findAs

@xylabs/array

function findAs<In, Out>(x, predicate): NonNullable<Out> | undefined;

Maps each element using the predicate and returns the first non-nullish result.

Type Parameters

In

In

Out

Out

Parameters

x

In[]

The input array

predicate

(a) => Out

Transform function applied to each element

Returns

NonNullable<Out> | undefined

The first non-nullish transformed value, or undefined

    ### <a id="findLastAs"></a>findLastAs

@xylabs/array

function findLastAs<In, Out>(x, predicate): NonNullable<Out> | undefined;

Maps each element using the predicate and returns the last non-nullish result.

Type Parameters

In

In

Out

Out

Parameters

x

In[]

The input array

predicate

(a) => Out

Transform function applied to each element

Returns

NonNullable<Out> | undefined

The last non-nullish transformed value, or undefined

    ### <a id="flatten"></a>flatten

@xylabs/array

function flatten<T>(a?, b?): T[];

Concatenates two values or arrays into a single flat array, filtering out nullish entries.

Type Parameters

T

T

Parameters

a?

T | ConcatArray<T>

First value or array

b?

T | ConcatArray<T>

Second value or array

Returns

T[]

A flat array of non-nullish elements

    ### <a id="uniq"></a>uniq

@xylabs/array

function uniq<T>(arr): T[];

Returns a new array with duplicate values removed.

Type Parameters

T

T

Parameters

arr

T[]

The input array

Returns

T[]

A deduplicated array

    ### <a id="uniqBy"></a>uniqBy

@xylabs/array

function uniqBy<T, I>(arr, iteratee): T[];

Returns a new array with duplicates removed, using a key function for comparison.

Type Parameters

T

T

I

I

Parameters

arr

T[]

The input array

iteratee

(item) => I

Function that returns the key to compare by

Returns

T[]

A deduplicated array keeping the first occurrence of each key

Keywords

xylabs

FAQs

Package last updated on 22 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts