even-index
v1.0.0
Published
Returns an array with items evenly indexed
Downloads
2
Maintainers
Readme
even-index
Returns an array with items evenly indexed
Features
npm
Install
npm install --save even-index
Script Tag
For Development
<script src="https://rawgit.com/Prosen-Ghosh/even-index/master/even-index.js"></script>
For Production
<script src="https://cdn.rawgit.com/Prosen-Ghosh/even-index/e1e72d3a/even-index.js"></script>
Usage
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
Author
Prosen Ghosh [email protected] (https://bd.linkedin.com/in/prosen-ghosh-baba9aa8)
License
- MIT