Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

arraygeous

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arraygeous

A JavaScript library for lightning fast array manipulation.

  • 0.1.24
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
21
increased by23.53%
Maintainers
1
Weekly downloads
 
Created
Source

arraygeous

A JavaScript library for lightning fast array manipulation. Build Status

Installation

Web browser

In vanilla, a arr global is exported. You can use the latest version from unpkg.

<script src="https://unpkg.com/arraygeous@0.1.24/build/arraygeous.js"></script>
<script src="https://unpkg.com/arraygeous@0.1.24/build/arraygeous.min.js"></script>

If you'd rather host it yourself, download the latest release from the build directory.

npm

npm i arraygeous -S
const arr = require("arraygeous");

API

arraygeous provides three types of functions.

  • Native JavaScript functions that run faster because arraygeous uses for loops.
  • Special functions that are not included among JavaScript's native array functions.
  • Math functions that perform arithmetic on arrays.

You can also call multiple functions on the same array by using arr.pipe(array). Return the result of the pipe with pipe.result().

Native

# arr.every(array, test) · Source

Returns a boolean representing whether every item in an array passes a test function.

# arr.filter(array, test) · Source

Returns a new array with every element in an array that passes a test, specified as a function.

# arr.find(array, test) · Source

Returns the value of the first element in an array that passes a test, specified as a function.

# arr.findIndex(array, test) · Source

Returns the index of the first element in an array that passes a test, specified as a function. Returns -1 if no element passes the test.

# arr.includes(array, value[, start]) · Source

Returns a boolean representing whether an array includes a value. You can specify where in the array to begin the seach with an optional start index.

# arr.map(array, accessor) · Source

Returns a new array with the result of calling an accessor function for each array element.

# arr.some(array, test) · Source

Returns a boolean representing whether any item in an array passes a test function.

Special

# arr.closest(array, value[, accessor]) · Source

Returns the closest element in an array to a value, ignoring invalid values (null, undefined, NaN, Infinity) in the array. The array can be mapped to an optional accessor function.

# arr.count(array[, accessor]) · Source

Returns an array of objects, where each object represents a unique value from an input array, according to an optional accessor function, and the number of items that value appears in the array.

# arr.flatten(array[, accessor]) · Source

Returns a single array from an array of arrays. You can map each item in the array to the value returned by an optional accessor function.

# arr.random(array) · Source

Returns a random item from an array.

# arr.sort(array[, accessor[, order]]) · Source

Sorts an array. You can map each item in the array to the value returned by an optional accessor function. Defaults to ascending order, but you can return descending order by specifying the third argument, order, as the string "desc". Invalid values other than Infinity and -Infinity (null, undefined, NaN) will be moved to the end.

# arr.unique(array[, accessor]) · Source

Returns the unique values of an array. You can map each item in the array to the value returned by an optional accessor function.

Math

# arr.cor(array[, x, y]) · Source

Returns the correlation coefficient of an array of paired values, where each pair is an array of two values. If your data is an array of objects, you can map each item in the array to a pair of values with optional x- and y-accessor functions.

# arr.cumsum(array[, accessor]) · Source

Returns the iterated cumulative sum of an array of values. You can map each item in the array to a value with an optional accessor function. Ignores invalid values (null, undefined, NaN, Infinity).

# arr.deviation(array[, accessor]) · Source

Returns the standard deviation of an array of values. You can map each item in the array to a value with an optional accessor function. Ignores invalid values (null, undefined, NaN, Infinity).

# arr.diff(array[, accessor[, lag]]) · Source

Returns lagged and iterated differences of an array of values. You can map each item in the array to a value with an optional accessor function. You can pass a third a third argument, lag, which is an integer indicating how many indices back to calculate the lag

# arr.extent(array[, accessor]) · Source

Returns the minimum and maximum, represented as [minimum, maximum], of an array of values. You can map each item in the array to a value with an optional accessor function. Ignores invalid values (null, undefined, NaN, Infinity).

# arr.max(array[, accessor]) · Source

Returns the maximum of an array of values. You can map each item in the array to a value with an optional accessor function. Ignores invalid values (null, undefined, NaN, Infinity).

# arr.maxIndex(array[, accessor]) · Source

Returns the index of the maximum of an array of values. You can map each item in the array to a value with an optional accessor function. Ignores invalid values (null, undefined, NaN, Infinity).

# arr.mean(array[, accessor]) · Source

Returns the mean of an array of values. You can map each item in the array to a value with an optional accessor function. Ignores invalid values (null, undefined, NaN, Infinity).

# arr.meanroll(array, n, [, accessor]) · Source

For each item in an array of values, calculates the trailing rolling average of n items. If the index of the item is less than n, calculates the avereage of the item's value and all previous values. You can map each item in the array to a value with an optional accessor function.

# arr.median(array[, accessor]) · Source

Returns the median of an array of values. You can map each item in the array to a value with an optional accessor function. Ignores invalid values (null, undefined, NaN, Infinity).

# arr.min(array[, accessor]) · Source

Returns the minimum of an array of values. You can map each item in the array to a value with an optional accessor function. Ignores invalid values (null, undefined, NaN, Infinity).

# arr.minIndex(array[, accessor]) · Source

Returns the index of the minimum of an array of values. You can map each item in the array to a value with an optional accessor function. Ignores invalid values (null, undefined, NaN, Infinity).

# arr.mode(array[, accessor]) · Source

Returns the mode or modes, represented as an array of numbers, of an array of values. You can map each item in the array to a value with an optional accessor function. Ignores invalid values (null, undefined, NaN, Infinity). If there is no mode, returns undefined.

# arr.sum(array[, accessor]) · Source

Returns the sum of an array. You can map each item in the array to the value returned by an optional accessor function. Ignores invalid values (null, undefined, NaN, Infinity).

# arr.variance(array[, accessor]) · Source

Returns the variance of an array of values. You can map each item in the array to a value with an optional accessor function. Ignores invalid values (null, undefined, NaN, Infinity).

Keywords

FAQs

Package last updated on 28 Jan 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc