@igorskyflyer/uarray
v2.0.0
Published
π Provides UArray, an Array type that supports negative indices/indexes, just wrap your regular JavaScript array with UArray() and you are all set! π
Maintainers
Readme
π Table of Contents
π€ 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:
pnpm add @igorskyflyer/uarrayyarn add @igorskyflyer/uarraynpm i @igorskyflyer/uarrayβΉοΈ Uses the built-in
Proxyobject, check browser compatibility on the Can I Use website.
ποΈ Examples
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.
πͺͺ License
Licensed under the MIT license which is available here, MIT license.
π Support
𧬠Related
π§΅ Provides ways of checking whether a String is present in an Array of Strings using custom Comparators. π
π‘ Parse, manage, compare and output SemVer-compatible version numbers. π‘
πͺ Provides ways of testing whether an array of chars is present inside a given String. β
𧬠A lightweight JavaScript utility allowing deep copy-by-value of nested objects, arrays and arrays of objects. πͺ
π¨ Provides common Color-related TypeScript types. π
π¨π»βπ» Author
Created by Igor DimitrijeviΔ (@igorskyflyer).
