Skip to content

Repository files navigation

@frosted/array-at

Ponyfill for Array.prototype.at

Installation

npm install @frosted/array-at

Usage

constat=require("@frosted/array-at")console.log(at([1,2,3],1))// 2console.log(at([20,40,60,80],-2))// 60console.log(at("not array",2))// Error: Expects an array

Shimming Array.prototype.at:

require("@frosted/array-at/shim")console.log([1,2,3].at(1))// 2

Tests

Simply clone the repo and run npm test