All Projects → sindresorhus → Negative Array

sindresorhus / Negative Array

Licence: mit
Negative array index support `array[-1]` using ES2015 Proxy

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Negative Array

Chunkify
Split an iterable into evenly sized chunks
Stars: ✭ 126 (-70%)
Mutual labels:  array, npm-package
Memoryjs
Read and write process memory in Node.js (Windows API functions exposed via Node bindings)
Stars: ✭ 371 (-11.67%)
Mutual labels:  npm-package
Meteor Now
Instantly deploy your Meteor apps with `meteor-now`
Stars: ✭ 339 (-19.29%)
Mutual labels:  npm-package
Eslint Formatter Pretty
Pretty ESLint formatter
Stars: ✭ 361 (-14.05%)
Mutual labels:  npm-package
Chronos
📊 📊 📊 Monitors the health and web traffic of servers, microservices, and containers with real-time data monitoring and receive automated notifications over Slack or email.
Stars: ✭ 347 (-17.38%)
Mutual labels:  npm-package
Arrayy
🗃 Array manipulation library for PHP, called Arrayy!
Stars: ✭ 363 (-13.57%)
Mutual labels:  array
Electron Timber
Pretty logger for Electron apps
Stars: ✭ 337 (-19.76%)
Mutual labels:  npm-package
Core
The internationalization (i18n) library for Angular
Stars: ✭ 4,027 (+858.81%)
Mutual labels:  npm-package
Loopy
A code generator for array-based code on CPUs and GPUs
Stars: ✭ 367 (-12.62%)
Mutual labels:  array
Conduct
🖖 Generate a Code of Conduct for your project
Stars: ✭ 360 (-14.29%)
Mutual labels:  npm-package
Squirrelly
Semi-embedded JS template engine that supports helpers, filters, partials, and template inheritance. 4KB minzipped, written in TypeScript ⛺
Stars: ✭ 359 (-14.52%)
Mutual labels:  npm-package
Wasmer Js
Monorepo for Javascript WebAssembly packages by Wasmer
Stars: ✭ 352 (-16.19%)
Mutual labels:  npm-package
Hashmap
HashMap JavaScript class for Node.js and the browser. The keys can be anything and won't be stringified
Stars: ✭ 363 (-13.57%)
Mutual labels:  array
Yddict
一个命令行查单词的工具💻 📚
Stars: ✭ 344 (-18.1%)
Mutual labels:  npm-package
Npm Module Boilerplate
Boilerplate for npm modules with ES6 features and all the best practices
Stars: ✭ 374 (-10.95%)
Mutual labels:  npm-package
Vue Drag Tree
🌴🌳a Vue's drag and drop tree component || 🌾Demo
Stars: ✭ 337 (-19.76%)
Mutual labels:  npm-package
Typescript Webpack Starter
⚡ create-ts-lib: A Starter Kit and a CLI to create your TypeScript / ES6 module bundled by Webpack without thinking about build or unit tests configurations. 🏠
Stars: ✭ 358 (-14.76%)
Mutual labels:  npm-package
Terminal Link
Create clickable links in the terminal
Stars: ✭ 361 (-14.05%)
Mutual labels:  npm-package
Laravel Helpers
An extensive set of Laravel framework helper functions and collection macros.
Stars: ✭ 407 (-3.1%)
Mutual labels:  array
Cpx
A cli tool to watch and copy file globs.
Stars: ✭ 394 (-6.19%)
Mutual labels:  npm-package

negative-array

Negative array index support array[-1] using ES2015 Proxy

JavaScript doesn't natively support the use of a negative index to get items backwards from the end, but with ES2015 Proxy it's possible. Take a look at the source to see how simple it is to implement and read this short article about it.

Install

$ npm install negative-array

Usage

const negativeArray = require('negative-array');

// Adds negative array index support to any given array
const unicorn = negativeArray(['🐴', '🎂', '🌈']);

// Get the last item by using a negative index
console.log(unicorn[-1]);
//=> '🌈'

// OMG, YES!

Related

  • on-change - Watch an object or array for changes (Uses Proxy too)
  • known - Allow only access to known object properties (Uses Proxy too)

License

MIT © Sindre Sorhus

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].