npm.io
1.0.2 • Published 7 months ago

@frosted/array-reverse

Licence
MIT
Version
1.0.2
Deps
18
Size
5 kB
Vulns
0
Weekly
0
Stars
1

@frosted/array-reverse

Ponyfill for Array.prototype.toReversed

Installation

npm install @frosted/array-reverse

Usage

const reverse = 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

Keywords