reversejs
reverse an array(or array-like objects) and do not mutate it.
Why
the problem with Array.prototype.reverse
:
it matute the array, so you can't apply it to immutable data structure.
for example:
reverse// TypeError: Cannot assign to read only property '0' of [object String]
Install
$ npm install --save reversejs
Usage
const reverse = // [3, 2, 1] // '界世'
API
reverse(arr)
arr
Type: array
or array-like objects
License
MIT © JIANG Di