Returns an array with items evenly indexed
npm install --save even-index
<script src="https://rawgit.com/Prosen-Ghosh/even-index/master/even-index.js"></script>
<script src="https://cdn.rawgit.com/Prosen-Ghosh/even-index/e1e72d3a/even-index.js"></script>
const evenIndex = require('even-index');
evenIndex([]);
//=> []
evenIndex([1]);
//=> [ 1 ]
evenIndex([1,-10]);
//=> [ 1 ]
evenIndex([1,-10,45]);
//=> [ 1, 45 ]
evenIndex(["foo","baz","bar","bob","tim"]);
//=> [ 'foo', 'bar', 'tim' ]
evenIndex(["foo","baz","bar",{a : 10},[10,20,30]]);
//=> [ 'foo', 'bar', [ 10, 20, 30 ] ]
evenIndex(["foo","baz","bar",[10,30],function(){}]);
//=> [ 'foo', 'bar', [Function] ]
evenIndex(); // without parameter this function will return a type error
//=> TypeError: expect an array got undefined
evenIndex({}); // this function only expect an array
//=> TypeError: expect an array got object
Prosen Ghosh prosenghosh25@gmail.com (https://bd.linkedin.com/in/prosen-ghosh-baba9aa8)
- MIT