{"id":16731411,"url":"https://github.com/skratchdot/array-any-index","last_synced_at":"2025-03-15T18:19:34.148Z","repository":{"id":57183888,"uuid":"46863747","full_name":"skratchdot/array-any-index","owner":"skratchdot","description":"get values from an array using any index: negative or float","archived":false,"fork":false,"pushed_at":"2016-09-20T17:34:49.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-22T08:03:06.156Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skratchdot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-25T13:37:24.000Z","updated_at":"2016-01-29T14:23:34.000Z","dependencies_parsed_at":"2022-08-23T01:20:52.048Z","dependency_job_id":null,"html_url":"https://github.com/skratchdot/array-any-index","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skratchdot%2Farray-any-index","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skratchdot%2Farray-any-index/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skratchdot%2Farray-any-index/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skratchdot%2Farray-any-index/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skratchdot","download_url":"https://codeload.github.com/skratchdot/array-any-index/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243770285,"owners_count":20345276,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T23:37:00.963Z","updated_at":"2025-03-15T18:19:34.122Z","avatar_url":"https://github.com/skratchdot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# array-any-index\n\n[![NPM version](https://badge.fury.io/js/array-any-index.svg)](http://badge.fury.io/js/array-any-index)\n[![Build Status](https://travis-ci.org/skratchdot/array-any-index.png?branch=master)](https://travis-ci.org/skratchdot/array-any-index)\n[![Code Climate](https://codeclimate.com/github/skratchdot/array-any-index.png)](https://codeclimate.com/github/skratchdot/array-any-index)\n[![Coverage Status](https://coveralls.io/repos/skratchdot/array-any-index/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/skratchdot/array-any-index?branch=master)\n[![Dependency Status](https://david-dm.org/skratchdot/array-any-index.svg)](https://david-dm.org/skratchdot/array-any-index)\n[![devDependency Status](https://david-dm.org/skratchdot/array-any-index/dev-status.svg)](https://david-dm.org/skratchdot/array-any-index#info=devDependencies)\n\n[![NPM](https://nodei.co/npm/array-any-index.png)](https://npmjs.org/package/array-any-index)\n\n\n## Description\n\nThis module allows you to get values from an array using any index.  This means\nthat you can pass in a negative index or a float value.  If float values are\npassed in, then interpolation will be used to calculate the value. If a negative\nindex is passed in, then we travel backwards through the array to get a value.\nIf an index that is larger than the array is passed in, we \"loop\" back through\nthe array to get the value.\n\nSee [Getting Started](#getting-started) below for usage instructions or\n[d3-interpolate](https://github.com/d3/d3-interpolate) for information on how\nwe calculate float indexes.\n\n\n## Getting Started\n\nInstall the module with: `npm install array-any-index`\n\n```javascript\nvar arrayGet = require('array-any-index');\nvar arr = [0, 1, 2, 3, 4, 5];\narrayGet(arr, 2); // result: 2\narrayGet(arr, 2.5); // result: 2.5\narrayGet(arr, -2); // result: 4\narrayGet(['red', 'blue'], 0.5); // result: '#080080'\n```\n\n- [Live example on Tonic](https://tonicdev.com/npm/array-any-index)\n\n\n## See Also\n\n- [array-jumper](https://www.npmjs.com/package/array-jumper)\n- [negative-array](https://www.npmjs.com/package/negative-array)\n\n\n## License\n\nCopyright (c) 2015 skratchdot  \nLicensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskratchdot%2Farray-any-index","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskratchdot%2Farray-any-index","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskratchdot%2Farray-any-index/lists"}