This module aims to add useful enhancements to the default Javascript and Typescript Array class, in order to help produce more succinct and pragmatic code.
Many of the functions here are influenced by Scala's rich library for array and list manipulation.
npm install @neonredwood/ts-arrayx
The simplest way to start using these extensions is simply to add this import to the top of a file:
import "@neonredwood/ts-arrayx";
// results is 6
[0, 1, 2, 3].sum();
This will automatically include access to all functions, by (naughty!) adding to the Array.prototype
.
You can also import functions you need individually:
import "@neonredwood/ts-arrayx/sliding";
// result is [[1, 2], [2, 3]]
[1, 2, 3].sliding(2);
See the documentation here.
Generated using TypeDoc