npm.io
1.0.1 • Published 10 years ago

length-1

Licence
MIT
Version
1.0.1
Deps
0
Vulns
0
Weekly
0
Stars
3

length-1 build status npm version

First negative index through Array

var getLengthMinus1 = require('./length-1');

// Arrays fixed
var arr = [1, 2, 3];
arr[-1]; // 3

// reusable tested functionality
Object.defineProperty(
  NodeList.prototype,
  -1,
  {get: getLengthMinus1}
);
document.querySelectorAll('#menu li')[-1];

Keywords