Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/justinfernald/yarra
JavaScript Arrays but beefed.
https://github.com/justinfernald/yarra
arrays javascript modules node typescript utilities yarra
Last synced: 5 days ago
JSON representation
JavaScript Arrays but beefed.
- Host: GitHub
- URL: https://github.com/justinfernald/yarra
- Owner: justinfernald
- License: mit
- Created: 2021-06-10T03:14:07.000Z (over 3 years ago)
- Default Branch: module-start
- Last Pushed: 2021-06-16T04:50:21.000Z (over 3 years ago)
- Last Synced: 2024-11-02T07:06:18.568Z (about 2 months ago)
- Topics: arrays, javascript, modules, node, typescript, utilities, yarra
- Language: TypeScript
- Homepage: https://justinfernald.github.io/Yarra/
- Size: 541 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://justinfernald.github.io/Yarra/)
---
## Install
```bash
npm install yarra.js
```---
## Examples
```javascript
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(); // -> 24for (let x of Y(1, 2, 3)); // works with iterator
```---
## Future Objectives
- Better performance
- Adding Tests