{"_id":"negative-index","_rev":"4213317","name":"negative-index","description":"Convert negative index to positive starting from the end","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"dfcreative","email":"df.creative@gmail.com"},{"name":"dy","email":"155263213@qq.com"}],"time":{"modified":"2026-03-04T17:07:49.000Z","created":"2016-09-15T19:36:38.032Z","2.0.0":"2023-01-09T16:03:57.512Z","1.0.3":"2018-10-26T16:56:01.589Z","1.0.2":"2017-01-27T10:20:15.984Z","1.0.1":"2016-10-04T21:52:18.537Z","1.0.0":"2016-09-15T19:36:38.032Z"},"users":{},"author":{"name":"ΔY","email":"dfcreative@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/dfcreative/negative-index.git"},"versions":{"2.0.0":{"name":"negative-index","version":"2.0.0","description":"Convert negative index to positive starting from the end","main":"index.js","type":"module","scripts":{"test":"node test"},"repository":{"type":"git","url":"git+https://github.com/dfcreative/negative-index.git"},"keywords":["normalize-offset","negative","index","slice","array","rotate","mod"],"author":{"name":"ΔY","email":"dfcreative@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/dfcreative/negative-index/issues"},"homepage":"https://github.com/dfcreative/negative-index#readme","gitHead":"68902d91571c6e5f1fc0773ec6757f6b544ef4ce","_id":"negative-index@2.0.0","_nodeVersion":"18.9.1","_npmVersion":"8.19.1","dist":{"shasum":"7dbbe6f12d68c9c821a912573d06250f5d87f5dd","size":966,"noattachment":false,"key":"/negative-index/-/negative-index-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/negative-index/download/negative-index-2.0.0.tgz"},"_npmUser":{"name":"dy","email":"df.creative@gmail.com"},"directories":{},"maintainers":[{"name":"dfcreative","email":"df.creative@gmail.com"},{"name":"dy","email":"155263213@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/negative-index_2.0.0_1673280237335_0.9481082970327563"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-01-09T16:03:57.512Z","publish_time":1673280237512,"_cnpm_publish_time":1673280237512},"1.0.3":{"name":"negative-index","version":"1.0.3","description":"Convert negative index to positive starting from the end","main":"index.js","scripts":{"test":"node test"},"repository":{"type":"git","url":"git+https://github.com/dy/negative-index.git"},"keywords":["normalize-offset","negative","index","slice","array","rotate","mod"],"author":{"name":"ΔY","email":"dfcreative@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/dy/negative-index/issues"},"homepage":"https://github.com/dy/negative-index#readme","dependencies":{"negative-zero":"^2.0.0"},"gitHead":"ee6ab6dc75bada8854aa9127078193816b8ddbc1","_id":"negative-index@1.0.3","_npmVersion":"6.4.1","_nodeVersion":"8.11.1","_npmUser":{"name":"dfcreative","email":"df.creative@gmail.com"},"dist":{"shasum":"d5cd63255dedf1f7894e1513a8b9526c7af387af","size":1012,"noattachment":false,"key":"/negative-index/-/negative-index-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/negative-index/download/negative-index-1.0.3.tgz"},"maintainers":[{"name":"dfcreative","email":"df.creative@gmail.com"},{"name":"dy","email":"155263213@qq.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/negative-index_1.0.3_1540572961435_0.4971754788583944"},"_hasShrinkwrap":false,"publish_time":1540572961589,"_cnpm_publish_time":1540572961589,"_cnpmcore_publish_time":"2021-12-17T02:18:31.666Z"},"1.0.2":{"name":"negative-index","version":"1.0.2","description":"Convert negative index to positive starting from the end","main":"index.js","scripts":{"test":"node test"},"repository":{"type":"git","url":"git+https://github.com/dfcreative/negative-index.git"},"keywords":["normalize-offset","negative","index","slice","array","rotate","mod"],"author":{"name":"ΔY","email":"dfcreative@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/dfcreative/negative-index/issues"},"homepage":"https://github.com/dfcreative/negative-index#readme","dependencies":{"is-negative-zero":"^2.0.0"},"gitHead":"f946cdcce48711e8ef1a7c06e14859cf356b5e6f","_id":"negative-index@1.0.2","_shasum":"bb0b349f9de80879326cfa54c56fb6b67ca4788d","_from":".","_npmVersion":"3.7.2","_nodeVersion":"6.2.0","_npmUser":{"name":"dfcreative","email":"df.creative@gmail.com"},"maintainers":[{"name":"dfcreative","email":"df.creative@gmail.com"},{"name":"dy","email":"155263213@qq.com"}],"dist":{"shasum":"bb0b349f9de80879326cfa54c56fb6b67ca4788d","size":1025,"noattachment":false,"key":"/negative-index/-/negative-index-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/negative-index/download/negative-index-1.0.2.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/negative-index-1.0.2.tgz_1485512415333_0.7015709551051259"},"directories":{},"publish_time":1485512415984,"_hasShrinkwrap":false,"_cnpm_publish_time":1485512415984,"_cnpmcore_publish_time":"2021-12-17T02:18:32.001Z"},"1.0.1":{"name":"negative-index","version":"1.0.1","description":"Convert negative index to positive starting from the end","main":"index.js","scripts":{"test":"node test"},"repository":{"type":"git","url":"git+https://github.com/dfcreative/negative-index.git"},"keywords":["normalize-offset","negative","index","slice","array","rotate","mod"],"author":{"name":"ΔY","email":"dfcreative@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/dfcreative/negative-index/issues"},"homepage":"https://github.com/dfcreative/negative-index#readme","dependencies":{"is-negative-zero":"^2.0.0"},"gitHead":"6dc9bdb3004ec2dc8a2a6bff7ad97145fcd14964","_id":"negative-index@1.0.1","_shasum":"589beda2f83ab6264c3ee7123872158d567930a6","_from":".","_npmVersion":"3.7.2","_nodeVersion":"6.2.0","_npmUser":{"name":"dfcreative","email":"df.creative@gmail.com"},"maintainers":[{"name":"dfcreative","email":"df.creative@gmail.com"},{"name":"dy","email":"155263213@qq.com"}],"dist":{"shasum":"589beda2f83ab6264c3ee7123872158d567930a6","size":1002,"noattachment":false,"key":"/negative-index/-/negative-index-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/negative-index/download/negative-index-1.0.1.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/negative-index-1.0.1.tgz_1475617936590_0.8607616925146431"},"directories":{},"publish_time":1475617938537,"_hasShrinkwrap":false,"_cnpm_publish_time":1475617938537,"_cnpmcore_publish_time":"2021-12-17T02:18:32.277Z"},"1.0.0":{"name":"negative-index","version":"1.0.0","description":"Convert negative index to positive starting from the end","main":"index.js","scripts":{"test":"node test"},"repository":{"type":"git","url":"git+https://github.com/dfcreative/negative-index.git"},"keywords":["normalize-offset","negative","index","slice","array","rotate","mod"],"author":{"name":"ΔY","email":"dfcreative@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/dfcreative/negative-index/issues"},"homepage":"https://github.com/dfcreative/negative-index#readme","gitHead":"85ba786a52eee407236b6f69d48e11f189a2979d","_id":"negative-index@1.0.0","_shasum":"f58c54aa787267e457f74b292a540a9ed3908069","_from":".","_npmVersion":"3.7.2","_nodeVersion":"6.2.0","_npmUser":{"name":"dfcreative","email":"df.creative@gmail.com"},"maintainers":[{"name":"dfcreative","email":"df.creative@gmail.com"},{"name":"dy","email":"155263213@qq.com"}],"dist":{"shasum":"f58c54aa787267e457f74b292a540a9ed3908069","size":900,"noattachment":false,"key":"/negative-index/-/negative-index-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/negative-index/download/negative-index-1.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/negative-index-1.0.0.tgz_1473968196043_0.051884132670238614"},"directories":{},"publish_time":1473968198032,"_hasShrinkwrap":false,"_cnpm_publish_time":1473968198032,"_cnpmcore_publish_time":"2021-12-17T02:18:32.486Z"}},"readme":"Convert negative index to positive starting from the end. Same way [Array.slice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) arguments work.\n\n[![npm install negative-index](https://nodei.co/npm/negative-index.png?mini=true)](https://npmjs.org/package/negative-index/)\n\n```js\nimport idx from 'negative-index';\n\n// idx(index, length)\n\nidx(-5, 8); //3\nidx(5, 8); //5\n```\n\nWorks well for normalizing real numbers offset, like time etc:\n\n```js\nimport normOffset from 'negative-index';\n\nlet time = -.15, duration = 2.45;\n\nnormOffset(time, duration); //2.3\n```\n","_attachments":{},"homepage":"https://github.com/dfcreative/negative-index#readme","bugs":{"url":"https://github.com/dfcreative/negative-index/issues"},"license":"MIT"}