# @igor.dvlpr/uarray

> 🎉 Provides UArray, an Array type that supports negative indices/indexes, just wrap your regular JavaScript array with UArray() and you are all set! 🙌

Latest version **1.2.2** (published 2022-04-28) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @igor.dvlpr/uarray
pnpm add @igor.dvlpr/uarray
yarn add @igor.dvlpr/uarray
bun add @igor.dvlpr/uarray
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2022-04-28 |
| First published | 2021-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=12.17 |
| Dependencies | 0 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Igor Dimitrijević |
| Maintainers | igor.dvlpr |
| Keywords | uarray, array, index, indices, negative, igordvlpr, utility |

## Links

- npm: https://www.npmjs.com/package/@igor.dvlpr/uarray
- Repository: https://github.com/igorskyflyer/npm-uarray
- Homepage: https://github.com/igorskyflyer/npm-uarray#readme
- Issues: https://github.com/igorskyflyer/npm-uarray/issues
- npm.io page: https://npm.io/package/@igor.dvlpr/uarray

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.2.2 (latest) — 2022-04-28
- 1.2.1 — 2021-08-09
- 1.2.0 — 2021-08-09
- 1.1.5 — 2021-07-16
- 1.1.4 — 2021-07-07
- 1.1.3 — 2021-07-07
- 1.1.2 — 2021-07-07
- 1.1.1 — 2021-07-07
- 1.1.0 — 2021-07-07
- 1.0.4 — 2021-07-06
- 1.0.3 — 2021-07-06
- 1.0.2 — 2021-07-05
- 1.0.1 — 2021-07-05
- 1.0.0 — 2021-07-05

## README

## 🎉 UArray 🙌

<p align="center">
	<img src="https://raw.githubusercontent.com/igorskyflyer/npm-uarray/main/assets/uArray.png" width="140" height="140">
</p>

<br>

Provides `UArray`, an `Array` type that supports negative indices/indexes, just wrap your _regular_ JavaScript array with `UArray()` or pass the elements directly to `UArray()` and you are all set! 🎉🙌

<br>

<blockquote align="center"> ⚠ Uses the built-in <code>Proxy</code> object, check browser compatibility on the <a href="https://caniuse.com/proxy"><strong>Can I Use</strong></a> website.
</blockquote>

<br>

<p align="center">
📢 This is the npm version of this project, if you are looking for the vanilla JavaScript version, check <a href="https://github.com/igorskyflyer/uarray"><strong>this</strong></a>.
</p>

<br>

### Usage

<br>

ℹ Works like negative indices in other languages, e.g. **-1** picks that **last** element, **-2,** the **second to last**, etc.

<br>

✨ Since `v.1.1.0` the function signature has been changed and now it supports 2 different ways of action. You can now pass a single parameter of type `Array` or multiple parameters of any primitive type.

<br>

Install it first by doing,

```shell
npm i "@igor.dvlpr/uarray"
```

<br>

and then use it,

<br>

```js
const UArray = require('@igor.dvlpr/uarray')
const food = UArray(['🍟', '🌭', '🍿', '🥙', '🥓']) // array passed
const objects = UArray('🎈', '🎩', '⚽', '🥇', '🎯') // no array passed, just direct values

console.log(food[-1]) // prints '🥓'
console.log(food[-3]) // prints '🍿'

console.log(objects[-1]) // prints '🎯'
console.log(objects[-3]) // prints '⚽'
```

<br>

<blockquote align="center">
🎉 Happy coding! 🙌
</blockquote>

---
_Source: https://npm.io/package/@igor.dvlpr/uarray · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
