array-invert

invert a JavaScript array

Usage no npm install needed!

<script type="module">
  import arrayInvert from 'https://cdn.skypack.dev/array-invert';
</script>

README

array-invert

NPM version build status Test coverage

Invert a JavaScript array. Though you probably want to use array.reverse() instead.

Installation

$ npm i --save array-invert

Overview

var invert = require('array-invert');

invert([1, 2, 3, 4, 5]);
// => [5, 4, 3, 2, 1]

API

invert(array)

Invert the order of an array.

invert(['chicken', 'cow', 'pig']);
// => ['pig', 'cow', 'chicken']

License

MIT © Yoshua Wuyts