{"name":"quickbit-universal","version":"2.0.0","description":"Universal wrapper for libquickbit with a JavaScript fallback","main":"index.js","browser":{"./index.js":"./fallback.js"},"scripts":{"test":"standard && brittle test.mjs","prebuild":"prebuildify --napi --cwd native"},"repository":{"type":"git","url":"git+https://github.com/holepunchto/quickbit-universal.git"},"author":{"name":"Kasper Isager Dalsgarð","email":"kasper@funktionel.co"},"license":"ISC","bugs":{"url":"https://github.com/holepunchto/quickbit-universal/issues"},"homepage":"https://github.com/holepunchto/quickbit-universal#readme","dependencies":{"b4a":"^1.6.0","node-gyp-build":"^4.5.0","simdle-universal":"^1.0.4"},"devDependencies":{"brittle":"^3.1.0","napi-macros":"^2.0.0","prebuildify":"^5.0.1","standard":"^17.0.0"},"gitHead":"784e5aea31ea4415f83595bb9e7fa3a5658cb1bd","_id":"quickbit-universal@2.0.0","_nodeVersion":"18.9.0","_npmVersion":"8.19.1","dist":{"integrity":"sha512-klbE0oBwmMgLcscFXytu1AY1k1xNAnhP+fjLyiVjbOGSMj774dOMo6uAO+lMvFRGkFMpfel+qvDQQ55YzxuOlA==","shasum":"df5c5c4848b011cc4cf457960a37ea2d2c573363","tarball":"http://registry-npm.ywwl.com/quickbit-universal/download/quickbit-universal-2.0.0.tgz","fileCount":11,"unpackedSize":332750,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCKCnH1C1U+fA2A6Vm1eQQf0Qu3geivlqZriUqiVmXccAIhAP7RVFk0LcoRwX00pPL2WC/M8ke+vrxp0DgJjUqljh7O"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjO+iYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqHUA//YQ1G6Ix4LUw/GO2njZeWGbnx9ZrQZHg1PIlI7DB6R3/KXqQ1\r\nx4Un1WcjCIUMf4sfdV7mmQ8kXTXqIMGFYY8rL7XYdJlE2vu1dLzxWnaXz3J/\r\nTRiHOrqLTm8w2ewq8HXpwfV0fCBirkNLiRJeT+zqj9NRQctsS6/D58pB8Xkk\r\nrr7gRNYiWtXJHXsFA7Hpt44TzC6Bw2aloRJEdE04VAvT++NhodamhqdM/R+b\r\naYpGDkO4U/EX9C0ghgMMwtP1Hixi7KrH4Oih6KVvz7uNvnw8N4FdaN5+eBc+\r\nuydOMTom3+BhfAtf0wFnWAy2zpUDm/JVDab8kZDaMdMLIjkU+AIBbkkC9nKY\r\nu+K5JGkSvq4eL3R1hQBgMctB1dxx9DtWFOyVwlSx2h9dQdLzDUM32n0bLjPK\r\nCdi4UEu1kAneggIdXQeT/9J+MVJLRw1WnaJ8fvD5xw3+lgOpCnbbaJDtsm2R\r\niAqv4EbUp/jxuVUBP780HOsYLkjfronuc8IgaKcVInY2Oz121Vtnc4wiD/L5\r\nv3OWeEC4BOQEdRrXCoGYdPIkaCF+J6bfFEWsPFhqg9pOdH8FXLoh05kV8jmz\r\nxhyr1c/cAsukO9MDcPSqFtiAxlDy5a6xgF2X4AJ7XhHMBK7EN0h5BoFRQOP+\r\n0hnoCZMiVbJ4VeCyXRsgZt3B+/FODt3C7JM=\r\n=3Tdc\r\n-----END PGP SIGNATURE-----\r\n","size":102081,"noattachment":false,"key":"/quickbit-universal/-/quickbit-universal-2.0.0.tgz"},"_npmUser":{"name":"kasperisager","email":"kasperisager@hey.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"kasperisager","email":"kasperisager@hey.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/quickbit-universal_2.0.0_1664870551899_0.046890597606015216"},"_hasShrinkwrap":false,"readme":"# quickbit-universal\n\nUniversal wrapper for https://github.com/holepunchto/libquickbit with a JavaScript fallback.\n\n```sh\nnpm install quickbit-universal\n```\n\n## Usage\n\n```js\nconst { get, set, findFirst } = require('quickbit-native')\n\nconst field = Buffer.alloc(256) // 2048 bits\n\nconst changed = set(field, 1000)\n// true\n\nget(field, 1000)\n// true\n\nfindFirst(field, true)\n// 1000\n```\n\n## API\n\n#### `const b = get(field, bit)`\n\nGet the given bit, which will either be `true` (set) or `false` (unset).\n\n#### `const changed = set(field, bit[, value])`\n\nSet the given bit to `value`, which defaults to `true`. Returns `true` if the bit changed, otherwise `false`.\n\n#### `field = fill(field, value[, start[, end]])`\n\nFill the given bit range with `value`. `start` defaults to `0` and `end` defaults to the bit length of the field. Returns the modified field.\n\n#### `clear(field, chunk)`\n\nClear the bits from `field` that are set in the `{ field, offset }` chunk.\n\n#### `const i = findFirst(field, value[, position])`\n\nReturn the index of the first occurrence of `value`, or `-1` if not found. If `position` is given, return the first index that is greater than or equal to `position`.\n\n#### `const i = findLast(field, value[, position])`\n\nReturn the index of the last occurrence of `value`, or `-1` if not found. If `position` is given, return the last index that is less than or equal to `position`.\n\n### Indexing\n\n#### `const index = Index.from(fieldOrChunks)`\n\nConstruct an index of the bits in a bit field or an array of sparse `{ field, offset }` chunks.\n\n#### `const changed = index.update(bit)`\n\nUpdate the given bit in the index.\n\n#### `const position = index.skipFirst(value[, position])`\n\nSkip the first parts of the index that contain nothing but `value`. If the index contains *only* `value`, the last index of the field is returned.\n\n#### `const position = index.skipLast(value[, position])`\n\nSkip the last parts of the index that contain nothing but `value`. If the index contains *only* `value`, the first index of the field is returned.\n\n## License\n\nApache 2.0\n","publish_time":1664870552111,"_cnpm_publish_time":1664870552111,"dist-tags":{"latest":"2.2.1"}}