Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/damianc/array.im
https://github.com/damianc/array.im
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/damianc/array.im
- Owner: damianc
- Created: 2024-01-06T21:34:25.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2024-01-06T21:43:23.000Z (12 months ago)
- Last Synced: 2024-01-06T22:26:38.335Z (12 months ago)
- Language: JavaScript
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# array.im
Set of methods that originally mutate an array, but when called from the `im` namespace, don't do that.
| Method | Description |
|--|--|
| `im.push(...items)` | returns given array with passed items added at the end |
| `im.pop()` | returns given array without its last item |
| `im.unshift(...items)` | returns given array with passed items added at the beginning |
| `im.shift()` | returns given array without its first item |
| `im.splice(index, removeCount, ...items)` | returns given array with passed items and/or without specific ones |
| `im.sort(comparer?)` | returns given array with items sorted |
| `im.reverse()` | returns given array with items reversed |```
const arr = [4,3,2,1];const ra = arr.im.reverse();
console.log(ra);
// [1,2,3,4]const ea = ra.im.push(5,6);
console.log(ea);
// [1,2,3,4,5,6]console.log(arr);
// [4,3,2,1]
```