New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@ultraq/array-utils

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ultraq/array-utils

A collection of utilities for JavaScript arrays

latest
Source
npmnpm
Version
3.1.1
Version published
Weekly downloads
804
-19.28%
Maintainers
1
Weekly downloads
 
Created
Source

array-utils

Build Status codecov npm Bundlephobia minified size

A collection of array utilities, meant as a zero-dependency way of working with arrays.

Installation

Via npm:

npm install @ultraq/array-utils

API

flatten(array)

Flattens an array of arrays of infinite depth into a single-dimension array.

This method is deprecated as it is now natively in JavaScript as the flat method on an Array instance: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat

  • array: The array of arrays to flatten

range(start, end, step)

Creates an array of numbers from the starting value (inclusive) to the end (exclusive), with an optional step (the gap between values).

  • start: The value to start at, the first item in the returned array.
  • end: The value to end with, the last item in the returned array.
  • step: The increment/gap between values, defaults to 1.

remove(array, predicate)

Remove and return the first item from array that matches the predicate function.

  • array: The array to search and remove an item from
  • predicate: Function to test each item of the array with. If it returns a truthy value for the item, then that item is removed and returned.

Keywords

array

FAQs

Package last updated on 24 Dec 2023

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