{"name":"quickbit-universal","version":"1.0.2","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"},"devDependencies":{"brittle":"^3.1.0","napi-macros":"^2.0.0","prebuildify":"^5.0.1","standard":"^17.0.0"},"gitHead":"930ac1f2db2f6cec186faeeeb8aa7752a384ce8a","_id":"quickbit-universal@1.0.2","_nodeVersion":"18.7.0","_npmVersion":"8.16.0","dist":{"integrity":"sha512-aSKxxYgWwqzp3L0XuaylWNtTI87z+KctScVoh17TYYADv8D2FJgWzhhugQwHvT7WfvOS6bmXcvEMpAyhtQtz7w==","shasum":"2f94a2db562245b69c7b048384098a347404d993","tarball":"http://registry-npm.ywwl.com/quickbit-universal/download/quickbit-universal-1.0.2.tgz","fileCount":10,"unpackedSize":251161,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQ6CO9+c9CEoErj83YAMCoIjLVfdvM8om+2aIloaksLAIgRYT7tUOYJo0b5LkVUBnufrI6n2d1o2OQC5EgMYDa3EE="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjFjfPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq0OQ/8Cm/o7YxAkNXt+HoT61OCrerRRHZa+/5qZag+Gi8MvtIYsy3r\r\nHDAIXQCVahnRjcwhtQmUUZB9EQ8Zma1pF8FsIKaWSfS+f3Bs4zUNX4SUXxM8\r\nBXm0FX7+8t+EjLcx8bk8NdIbwgO1NlGywv9Mu3wwT5mXr/kLOtIF72ON3lNR\r\nHzihR/YzU0jibATpjLr9F7eu1drNthDaEVHAiZo53I338qEopgCxyd1RNdww\r\n2nURvGDF7F/pRHT0yvlocK/dKU55HrsXrydeWVF6EDYQ3zLgNlMAmC7qHRWf\r\n8VM+ICLUPAfwatWKnYu52qkcJCe4U7c5BDhmiGrg4ObddKdIfWE7ZpXjXh3u\r\n/XevnZRE3dfGf+B4cgzsv/PebRKR3nlC+y+skN2Zql/t6ln7QjgFwgohDHot\r\nM7ZA+eaASz86M39Ft5PB9/CQFawxFWlI+xKPI0MdNqjwwBjAC72feXLmYf+6\r\ncgCwWMWInDObs4DVGIsygiw9SutGYlYzFAgnvnX+sj94dGn2gUlygM9q3kLg\r\nXAOntAyzZazoE8LEJuB41fIkJqZquiFpJ0/30RZyo27VU7TMnaXMr3o0fNy+\r\nNnF9Pj6zXK/Ls2YaU4S5CwCoceFEFV7qaFIfvPMj5xcuEmzl8bV4hYRUoYpR\r\nelvK5FNFfs2IWcLQ7d9LflKyhZUuGcqN+/E=\r\n=eBBn\r\n-----END PGP SIGNATURE-----\r\n","size":76376,"noattachment":false,"key":"/quickbit-universal/-/quickbit-universal-1.0.2.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_1.0.2_1662400462906_0.499705875554862"},"_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":1662400463143,"_cnpm_publish_time":1662400463143,"dist-tags":{"latest":"2.2.1"}}