An open API service indexing awesome lists of open source software.

https://github.com/igorskyflyer/npm-uarray

πŸŽ‰ Provides UArray, an Array type that supports negative indices/indexes, just wrap your regular JavaScript array with UArray() and you are all set! πŸ™Œ
https://github.com/igorskyflyer/npm-uarray

access array back-end igorskyflyer index javascript mocha negative nodejs npm uarray utility

Last synced: about 2 months ago
JSON representation

πŸŽ‰ Provides UArray, an Array type that supports negative indices/indexes, just wrap your regular JavaScript array with UArray() and you are all set! πŸ™Œ

Awesome Lists containing this project

README

          


Icon of UArray

UArray




πŸŽ‰ Provides UArray, an Array type that supports negative indices/indexes, just wrap your regular JavaScript array with UArray() and you are all set! πŸ™Œ




## πŸ“ƒ Table of Contents

- [Features](#-features)
- [Usage](#-usage)
- [Examples](#️-examples)
- [Changelog](#-changelog)
- [Support](#-support)
- [License](#-license)
- [Related](#-related)
- [Author](#-author)




## πŸ€– Features

- πŸ”’ Negative indexing (-1, -2, etc.)
- 🧳 Accepts array or multiple values
- πŸͺž Behaves like a native array
- πŸ› οΈ Supports all standard methods
- 🧼 Safe fallback for non-numeric keys
- πŸ§ͺ Ideal for reverse access and testing
- πŸš€ Drop-in replacement, zero config




## πŸ•΅πŸΌ Usage

Install it by executing any of the following, depending on your preferred package manager:

```bash
pnpm add @igorskyflyer/uarray
```

```bash
yarn add @igorskyflyer/uarray
```

```bash
npm i @igorskyflyer/uarray
```


> ℹ️
> Uses the built-in `Proxy` object, check browser compatibility on the [Can I Use](https://caniuse.com/proxy) website.
>




## πŸ—’οΈ Examples

```js
import { UArray } from '@igorskyflyer/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 '⚽'
```




## πŸ“ Changelog

πŸ“‘ The changelog is available here, [CHANGELOG.md](https://github.com/igorskyflyer/npm-uarray/blob/main/CHANGELOG.md).




## πŸͺͺ License

Licensed under the MIT license which is available here, [MIT license](https://github.com/igorskyflyer/npm-uarray/blob/main/LICENSE).




## πŸ’– Support


I work hard for every project, including this one and your support means a lot to me!


Consider buying me a coffee. β˜•




Donate to igorskyflyer




Thank you for supporting my efforts! πŸ™πŸ˜Š




## 🧬 Related

[@igorskyflyer/str-is-in](https://www.npmjs.com/package/@igorskyflyer/str-is-in)

> _🧡 Provides ways of checking whether a String is present in an Array of Strings using custom Comparators. πŸ”_


[@igorskyflyer/keppo](https://www.npmjs.com/package/@igorskyflyer/keppo)

> _🎑 Parse, manage, compare and output SemVer-compatible version numbers. πŸ›‘_


[@igorskyflyer/chars-in-string](https://www.npmjs.com/package/@igorskyflyer/chars-in-string)

> _πŸͺ Provides ways of testing whether an array of chars is present inside a given String. β˜„_


[@igorskyflyer/clone](https://www.npmjs.com/package/@igorskyflyer/clone)

> _🧬 A lightweight JavaScript utility allowing deep copy-by-value of nested objects, arrays and arrays of objects. πŸͺ_


[@igorskyflyer/common-color](https://www.npmjs.com/package/@igorskyflyer/common-color)

> _🎨 Provides common Color-related TypeScript types. 🌈_






## πŸ‘¨πŸ»β€πŸ’» Author
Created by **Igor Dimitrijević** ([*@igorskyflyer*](https://github.com/igorskyflyer/)).