{"_id":"sparse-array","_rev":"4646768","name":"sparse-array","description":"Sparse array implementation in JS with no dependencies","dist-tags":{"latest":"1.3.2"},"maintainers":[{"name":"pgte","email":"pedro.teixeira@gmail.com"}],"time":{"modified":"2026-04-10T20:19:33.000Z","created":"2017-01-24T12:44:24.268Z","1.3.2":"2018-12-04T10:49:20.062Z","1.3.1":"2017-01-26T13:00:55.128Z","1.3.0":"2017-01-25T11:16:05.628Z","1.2.1":"2017-01-24T17:13:27.693Z","1.2.0":"2017-01-24T16:40:12.858Z","1.1.2":"2017-01-24T16:29:22.053Z","1.1.1":"2017-01-24T15:09:33.565Z","1.1.0":"2017-01-24T14:40:07.803Z","1.0.0":"2017-01-24T12:44:24.268Z"},"users":{},"author":{"name":"pgte"},"repository":{"type":"git","url":"git+https://github.com/pgte/js-sparse-array.git"},"versions":{"1.3.2":{"name":"sparse-array","version":"1.3.2","description":"Sparse array implementation in JS with no dependencies","main":"index.js","scripts":{"test":"tape tests/*.js"},"repository":{"type":"git","url":"git+https://github.com/pgte/js-sparse-array.git"},"keywords":["sparse","array","sparse","array"],"author":{"name":"pgte"},"license":"ISC","bugs":{"url":"https://github.com/pgte/js-sparse-array/issues"},"homepage":"https://github.com/pgte/js-sparse-array#readme","devDependencies":{"tape":"^4.6.3"},"gitHead":"a489406f6abb5aa4bb7b536b8b73289944bf4343","_id":"sparse-array@1.3.2","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"pgte","email":"i@pgte.me"},"dist":{"shasum":"0e1a8b71706d356bc916fe754ff496d450ec20b0","size":3759,"noattachment":false,"key":"/sparse-array/-/sparse-array-1.3.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/sparse-array/download/sparse-array-1.3.2.tgz"},"maintainers":[{"name":"pgte","email":"pedro.teixeira@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sparse-array_1.3.2_1543920559931_0.277120974525523"},"_hasShrinkwrap":false,"publish_time":1543920560062,"_cnpm_publish_time":1543920560062,"_cnpmcore_publish_time":"2021-12-16T20:50:45.919Z"},"1.3.1":{"name":"sparse-array","version":"1.3.1","description":"Sparse array implementation in JS with no dependencies","main":"index.js","scripts":{"test":"tape tests/*.js"},"repository":{"type":"git","url":"git+https://github.com/pgte/js-sparse-array.git"},"keywords":["sparse","array","sparse","array"],"author":{"name":"pgte"},"license":"ISC","bugs":{"url":"https://github.com/pgte/js-sparse-array/issues"},"homepage":"https://github.com/pgte/js-sparse-array#readme","devDependencies":{"tape":"^4.6.3"},"gitHead":"3fcdcc305d54c91c2cc71a46110174fe0997dfcd","_id":"sparse-array@1.3.1","_shasum":"d569b98b9e49233d4418de6098502a4a6c41d83c","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"pgte","email":"pedro.teixeira@gmail.com"},"dist":{"shasum":"d569b98b9e49233d4418de6098502a4a6c41d83c","size":3852,"noattachment":false,"key":"/sparse-array/-/sparse-array-1.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/sparse-array/download/sparse-array-1.3.1.tgz"},"maintainers":[{"name":"pgte","email":"pedro.teixeira@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/sparse-array-1.3.1.tgz_1485435654479_0.13237649924121797"},"directories":{},"publish_time":1485435655128,"_hasShrinkwrap":false,"_cnpm_publish_time":1485435655128,"_cnpmcore_publish_time":"2021-12-16T20:50:46.105Z"},"1.3.0":{"name":"sparse-array","version":"1.3.0","description":"Sparse array implementation in JS with no dependencies","main":"index.js","scripts":{"test":"tape tests/*.js"},"repository":{"type":"git","url":"git+https://github.com/pgte/js-sparse-array.git"},"keywords":["sparse","array","sparse","array"],"author":{"name":"pgte"},"license":"ISC","bugs":{"url":"https://github.com/pgte/js-sparse-array/issues"},"homepage":"https://github.com/pgte/js-sparse-array#readme","devDependencies":{"tape":"^4.6.3"},"gitHead":"c42481aca62e7cd996ad05c9e1e3f69b242209a6","_id":"sparse-array@1.3.0","_shasum":"62c44aae8029c10263d87490b6f67a2dcfbf6d68","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"pgte","email":"pedro.teixeira@gmail.com"},"dist":{"shasum":"62c44aae8029c10263d87490b6f67a2dcfbf6d68","size":3851,"noattachment":false,"key":"/sparse-array/-/sparse-array-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sparse-array/download/sparse-array-1.3.0.tgz"},"maintainers":[{"name":"pgte","email":"pedro.teixeira@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/sparse-array-1.3.0.tgz_1485342965041_0.16243722080253065"},"directories":{},"publish_time":1485342965628,"_hasShrinkwrap":false,"_cnpm_publish_time":1485342965628,"_cnpmcore_publish_time":"2021-12-16T20:50:46.320Z"},"1.2.1":{"name":"sparse-array","version":"1.2.1","description":"Sparse array implementation in JS with no dependencies","main":"index.js","scripts":{"test":"tape tests/*.js"},"repository":{"type":"git","url":"git+https://github.com/pgte/js-sparse-array.git"},"keywords":["sparse","array","sparse","array"],"author":{"name":"pgte"},"license":"ISC","bugs":{"url":"https://github.com/pgte/js-sparse-array/issues"},"homepage":"https://github.com/pgte/js-sparse-array#readme","devDependencies":{"tape":"^4.6.3"},"gitHead":"e5c1de5693cd43d99aa5545cfff3ae8421f1094a","_id":"sparse-array@1.2.1","_shasum":"3db3587fa750afa9e999b42cd40a40c2bc248bae","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"pgte","email":"pedro.teixeira@gmail.com"},"dist":{"shasum":"3db3587fa750afa9e999b42cd40a40c2bc248bae","size":2894,"noattachment":false,"key":"/sparse-array/-/sparse-array-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/sparse-array/download/sparse-array-1.2.1.tgz"},"maintainers":[{"name":"pgte","email":"pedro.teixeira@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/sparse-array-1.2.1.tgz_1485278007145_0.1424338980577886"},"directories":{},"publish_time":1485278007693,"_hasShrinkwrap":false,"_cnpm_publish_time":1485278007693,"_cnpmcore_publish_time":"2021-12-16T20:50:46.532Z"},"1.2.0":{"name":"sparse-array","version":"1.2.0","description":"Sparse array implementation in JS with no dependencies","main":"index.js","scripts":{"test":"tape tests/*.js"},"repository":{"type":"git","url":"git+https://github.com/pgte/js-sparse-array.git"},"keywords":["sparse","array","sparse","array"],"author":{"name":"pgte"},"license":"ISC","bugs":{"url":"https://github.com/pgte/js-sparse-array/issues"},"homepage":"https://github.com/pgte/js-sparse-array#readme","devDependencies":{"tape":"^4.6.3"},"gitHead":"0b5062ea4ea95e02bafa75a9b11d39367896909f","_id":"sparse-array@1.2.0","_shasum":"eecf0676e4466a161009b2bf65224e5e514ef7ac","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"pgte","email":"pedro.teixeira@gmail.com"},"dist":{"shasum":"eecf0676e4466a161009b2bf65224e5e514ef7ac","size":2768,"noattachment":false,"key":"/sparse-array/-/sparse-array-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sparse-array/download/sparse-array-1.2.0.tgz"},"maintainers":[{"name":"pgte","email":"pedro.teixeira@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/sparse-array-1.2.0.tgz_1485276010966_0.614256513537839"},"directories":{},"publish_time":1485276012858,"_hasShrinkwrap":false,"_cnpm_publish_time":1485276012858,"_cnpmcore_publish_time":"2021-12-16T20:50:46.751Z"},"1.1.2":{"name":"sparse-array","version":"1.1.2","description":"Sparse array implementation in JS with no dependencies","main":"index.js","scripts":{"test":"tape tests/*.js"},"repository":{"type":"git","url":"git+https://github.com/pgte/js-sparse-array.git"},"keywords":["sparse","array","sparse","array"],"author":{"name":"pgte"},"license":"ISC","bugs":{"url":"https://github.com/pgte/js-sparse-array/issues"},"homepage":"https://github.com/pgte/js-sparse-array#readme","devDependencies":{"tape":"^4.6.3"},"gitHead":"d7ae9732b00bdfd837130a19af6c8f1252276a84","_id":"sparse-array@1.1.2","_shasum":"c75c07c1d6006b08246bc84bf89c8a74338a1e73","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"pgte","email":"pedro.teixeira@gmail.com"},"dist":{"shasum":"c75c07c1d6006b08246bc84bf89c8a74338a1e73","size":2575,"noattachment":false,"key":"/sparse-array/-/sparse-array-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/sparse-array/download/sparse-array-1.1.2.tgz"},"maintainers":[{"name":"pgte","email":"pedro.teixeira@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/sparse-array-1.1.2.tgz_1485275360334_0.5096467731054872"},"directories":{},"publish_time":1485275362053,"_hasShrinkwrap":false,"_cnpm_publish_time":1485275362053,"_cnpmcore_publish_time":"2021-12-16T20:50:46.945Z"},"1.1.1":{"name":"sparse-array","version":"1.1.1","description":"Sparse array implementation in JS with no dependencies","main":"index.js","scripts":{"test":"tape tests/*.js"},"repository":{"type":"git","url":"git+https://github.com/pgte/js-sparse-array.git"},"keywords":["sparse","array","sparse","array"],"author":{"name":"pgte"},"license":"ISC","bugs":{"url":"https://github.com/pgte/js-sparse-array/issues"},"homepage":"https://github.com/pgte/js-sparse-array#readme","devDependencies":{"tape":"^4.6.3"},"gitHead":"dd08993e5ba2e5b36a4c097c3f1325b6b3e9a20c","_id":"sparse-array@1.1.1","_shasum":"bba0a8cb8845cc148bafa5494d8bf31cf0135bc3","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"pgte","email":"pedro.teixeira@gmail.com"},"dist":{"shasum":"bba0a8cb8845cc148bafa5494d8bf31cf0135bc3","size":2436,"noattachment":false,"key":"/sparse-array/-/sparse-array-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/sparse-array/download/sparse-array-1.1.1.tgz"},"maintainers":[{"name":"pgte","email":"pedro.teixeira@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/sparse-array-1.1.1.tgz_1485270572977_0.2150203944183886"},"directories":{},"publish_time":1485270573565,"_hasShrinkwrap":false,"_cnpm_publish_time":1485270573565,"_cnpmcore_publish_time":"2021-12-16T20:50:47.185Z"},"1.1.0":{"name":"sparse-array","version":"1.1.0","description":"Sparse array implementation in JS with no dependencies","main":"index.js","scripts":{"test":"tape tests/*.js"},"repository":{"type":"git","url":"git+https://github.com/pgte/js-sparse-array.git"},"keywords":["sparse","array","sparse","array"],"author":{"name":"pgte"},"license":"ISC","bugs":{"url":"https://github.com/pgte/js-sparse-array/issues"},"homepage":"https://github.com/pgte/js-sparse-array#readme","devDependencies":{"tape":"^4.6.3"},"gitHead":"47b60c59b52c5c13af6396b11e6cdde1f4de27e6","_id":"sparse-array@1.1.0","_shasum":"a6d5bb9fb76f40709d2267b213a882643ede79f1","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"pgte","email":"pedro.teixeira@gmail.com"},"dist":{"shasum":"a6d5bb9fb76f40709d2267b213a882643ede79f1","size":2435,"noattachment":false,"key":"/sparse-array/-/sparse-array-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sparse-array/download/sparse-array-1.1.0.tgz"},"maintainers":[{"name":"pgte","email":"pedro.teixeira@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/sparse-array-1.1.0.tgz_1485268806088_0.6543043139390647"},"directories":{},"publish_time":1485268807803,"_hasShrinkwrap":false,"_cnpm_publish_time":1485268807803,"_cnpmcore_publish_time":"2021-12-16T20:50:47.387Z"},"1.0.0":{"name":"sparse-array","version":"1.0.0","description":"Sparse array implementation in JS with no dependencies","main":"index.js","scripts":{"test":"tape tests/*.js"},"repository":{"type":"git","url":"git+https://github.com/pgte/js-sparse-array.git"},"keywords":["sparse","array","sparse","array"],"author":{"name":"pgte"},"license":"ISC","bugs":{"url":"https://github.com/pgte/js-sparse-array/issues"},"homepage":"https://github.com/pgte/js-sparse-array#readme","devDependencies":{"tape":"^4.6.3"},"gitHead":"eea28f34cf597d5a2f162ae81cd49f979c4d1fb1","_id":"sparse-array@1.0.0","_shasum":"a168fb6d6f16397afdf15e2c7f9df400958ba785","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"pgte","email":"pedro.teixeira@gmail.com"},"dist":{"shasum":"a168fb6d6f16397afdf15e2c7f9df400958ba785","size":1901,"noattachment":false,"key":"/sparse-array/-/sparse-array-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sparse-array/download/sparse-array-1.0.0.tgz"},"maintainers":[{"name":"pgte","email":"pedro.teixeira@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/sparse-array-1.0.0.tgz_1485261862275_0.04509072587825358"},"directories":{},"publish_time":1485261864268,"_hasShrinkwrap":false,"_cnpm_publish_time":1485261864268,"_cnpmcore_publish_time":"2021-12-16T20:50:47.637Z"}},"readme":"# sparse-array\n\n[![Build Status](https://travis-ci.org/pgte/js-sparse-array.svg?branch=master)](https://travis-ci.org/pgte/js-sparse-array)\n\nSparse array implementation in JS with no dependencies\n\n## Install\n\n```bash\n$ npm install sparse-array --save\n```\n\n## Use\n\n### Create:\n\n```js\nconst SparseArray = require('sparse-array')\nconst arr = new SparseArray()\n```\n\n### Set, get and unset:\n\n```js\nconst index = 0\narr.set(index, 'value')\n\narr.get(index) // 'value'\n\narr.unset(index)\n\narr.get(index) // undefined\n```\n\n### Iterate:\n\n```js\narr.forEach((elem, index) => {\n  console.log('elem: %j at %d', elem, index)\n})\n\nconst mapped = arr.map((elem, index) => {\n  return elem + 1\n})\n\nconst result = arr.reduce((acc, elem, index) => {\n  return acc + Number(elem)\n}, 0)\n```\n\n### Find:\n\n```js\nconst firstEven = arr.find((elem) => (elem % 2) === 0)\n```\n\n### Internal representation:\n\n#### Bit field:\n\n```js\nconst bitField = arr.bitField()\n```\n\n#### Compact array:\n\n```js\nconst compacted = arr.compactArray()\n```\n\n## License\n\nISC","_attachments":{},"homepage":"https://github.com/pgte/js-sparse-array#readme","bugs":{"url":"https://github.com/pgte/js-sparse-array/issues"},"license":"ISC"}