even-index

1.0.0 • Public • Published

even-index

Returns an array with items evenly indexed

npm license github-issues

travis-status stars forks

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",{: 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 prosenghosh25@gmail.com (https://bd.linkedin.com/in/prosen-ghosh-baba9aa8)

License

  • MIT

Package Sidebar

Install

npm i even-index

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • prosen-ghosh