npm

odd-index

1.0.1 • Public • Published

odd-index

Returns an array with items oddly indexed

npm license github-issues

travis-status stars forks

Features

Install

npm install --save odd-index

Script Tag

For Development

<script src="https://rawgit.com/Prosen-Ghosh/odd-index/master/odd-index.js"></script>

For Production

<script src="https://cdn.rawgit.com/Prosen-Ghosh/odd-index/737cb365/odd-index.js"></script>

Usage

 
const oddIndex = require('odd-index');
 
oddIndex([]);
//=> []
 
oddIndex([1]);
//=> []
 
oddIndex([1,2,3,4]);
//=> [ 2, 4 ]
 
oddIndex(["foo","bar","baz","bob"]);
//=> [ 'bar', 'bob' ]
 
oddIndex(["foo","bar","baz","bob",[1,2],[3,4]]);
//=> [ 'bar', 'bob', [ 3, 4 ] ]
 
oddIndex(["foo","bar","baz","bob",[1,2],{: 10}]);
//=> [ 'bar', 'bob', { a: 10 } ]
 
oddIndex(["foo","bar","baz","bob",[1,2],{: 10},100,function(){}]);
//=> [ 'bar', 'bob', { a: 10 }, [Function] ]
 
oddIndex(); // without parameter thid function will throw a type error
//=> TypeError: expect an array got undefined
 
oddIndex({}); // this function only takes array argument
//=> TypeError: expect an array got object
 

Author

Prosen Ghosh prosenghosh25@gmail.com (https://bd.linkedin.com/in/prosen-ghosh-baba9aa8)

License

  • MIT

Readme

Keywords

Package Sidebar

Install

npm i odd-index

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • prosen-ghosh