odd-index
v1.0.1
Published
Returns an array with items oddly indexed
Downloads
2
Readme
odd-index
Returns an array with items oddly indexed
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],{a : 10}]);
//=> [ 'bar', 'bob', { a: 10 } ]
oddIndex(["foo","bar","baz","bob",[1,2],{a : 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 [email protected] (https://bd.linkedin.com/in/prosen-ghosh-baba9aa8)
License
- MIT