Skip to content
This repository has been archived by the owner on Nov 2, 2019. It is now read-only.

Prosen-Ghosh/even-index

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

License

  • MIT

Releases

No releases published

Packages

No packages published