1.0.1 • Published 7 years ago

odd-index v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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

License

  • MIT