Skip to content

Repository files navigation

@frosted/array-reverse

Ponyfill for Array.prototype.toReversed

Installation

npm install @frosted/array-reverse

Usage

constreverse=require("@frosted/array-reverse")console.log(reverse([1,2,3]))// [3, 2, 1]console.log(reverse("not array"))// Error: Expects an array

Shimming Array.prototype.reverse:

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

Tests

Simply clone the repo and run npm test