Skip to content

frosted-javascript/array-reverse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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