indexable-at

1.0.1 • Public • Published

indexable-at NPM version

polyfill for Array#at https://github.com/tc39/proposal-relative-indexing-method

Install

Install with npm:

$ npm install --save indexable-at

Usage

require('indexable-at');

const arr = [1, 2, 3, 4, 5, 6];
console.log(arr.at(1)); // 2
console.log(arr.at(-1)); // 6

const str = 'abcde';
console.log(str.at(1)); // 'b'
console.log(str.at(-1)); // 'e'

const int8 = new Int8Array([1, 2, 3, 4]);
console.log(int8.at(-1)); // 4

Readme

Keywords

Package Sidebar

Install

npm i indexable-at

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

3.33 kB

Total Files

4

Last publish

Collaborators

  • beiweiqiang