yarra.js
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

Yarra

JavaScript Arrays but beefed.

Overview

The goal of Yarra is to add common array operations to arrays objects that do not already exists. Yarra is not about speed, but to not completely ignore speed.

It is possible to add onto the prototype of Array in JavaScript, but that is very bad practice for many reasons, so the recommendation is to stay very clear of that. So Yarra extends off of Array.

The syntax of using Yarra attempts to keep as much similarity as possible. Yarra pulls inspiration from the array methods from Lodash.

Link to Documentation


Install

npm install yarra.js

Examples

Y(3, 2, 1); // -> Y[3,2,1]
Y([3, 2, 1]); // -> Y[3,2,1]
Y([
    [
        [1, 2, 3],
        [4, 5, 6],
    ],
    [
        [7, 8, 9],
        [10, 11, 12],
    ],
]).dimensions; // -> [2,2,3]
Y(1, 2, 3, 4).tail(); // -> Y[2,3,4]
Y(34, 2, 5, 62, 1).length; // -> 5
Y(1, 2).equals(Y(1, 2)); // -> true
Y(1, 3, 5, 2, 1, 5, 7).unique(); // -> Y[1,3,5,2,7]
Y(1, undefined, 5, 0, false, null).compact(); // -> Y[1,5]
Y(1, 2, 3, 4).sum(); // -> 10
Y(1, 2, 3, 4).product(); // -> 24

for (let x of Y(1, 2, 3)); // works with iterator

Future Objectives

  • Better performance
  • Adding Tests

Readme

Keywords

Package Sidebar

Install

npm i yarra.js

Weekly Downloads

1

Version

1.0.6

License

MIT

Unpacked Size

67.5 kB

Total Files

7

Last publish

Collaborators

  • justinfernald