{"name":"quickbit-universal","version":"1.2.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","simdle-universal":"^1.0.4"},"devDependencies":{"brittle":"^3.1.0","napi-macros":"^2.0.0","prebuildify":"^5.0.1","standard":"^17.0.0"},"gitHead":"4454aacd51c5c48e5258921326051f43db1a3b34","_id":"quickbit-universal@1.2.2","_nodeVersion":"18.9.0","_npmVersion":"8.19.1","dist":{"integrity":"sha512-mTTI3BUTV61a8TU+/KLrdpn8zMDNhjg5Sz8UngiPNARw1Sb3g+xLfSz5MCRYX9l9/Qs45xAU9vXON2rgeV7D6g==","shasum":"b1245a43f17226bb657b7688a76b6b8081af7c20","tarball":"http://registry-npm.ywwl.com/quickbit-universal/download/quickbit-universal-1.2.2.tgz","fileCount":11,"unpackedSize":280110,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCmyFUmMuXYRcISRWyBW9g9Ps+ce5wiTuisjsIjX04OuwIhAJvEZ9rkm6rtzrmBgBDJ+inBHWL97z83MJ5fruTw2iyh"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjKw0GACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrnyg/+N4jMSNvAlhT1SMzttqJt7Qw2nE2zxfvtj/0KI5hClZP5tAnJ\r\nWkOVnFf6DWAFZ9v2UxyISJ0tIkevyDdjGZHHuuV7sh99Dh5wqSzfZhKi/vqe\r\nd2FkKkjMnJXpd6tr4UOeErjGogdl9xAZixI0XlICpqcZWPaG0/70NkIBf090\r\nCHh8cdKf1YWmVkMHM8zH8mjXR5LkoYGYvUztr6cKWLUOOuiZOgBSMzwAKStx\r\nCjgT1kuMJsB6pcoWVzYShsoPV17ZbQIe4neV6NlDRQpVX7QZhRUZQR9Cd1RR\r\nY4KiKkd4bOZZPv/01jFuTtjJins6qq+VY9oYLq95Xn+6dYvHo1LLCrE+PFz4\r\n/hkmadM5FxCRNcDdKfSe4KSOCDRymqNCKoCcg11iZB9bpgy2U/VGzC6EuX75\r\nEO58E4bG947W2rhFPZU1jQzhQr3IU0TRQK7gHT3EZWjw1fhU9QrrR9ozjA5f\r\npW4stjSTSnNzPIsJdRp04TnnLXgxfmjpWV2GvXRR7DaEqRh8sYZMeu4bABU6\r\nWVU1ZlQzH/48Fr7WczEiokUD9Sr0O0JlzLBlsckmBIPAcFjhL2Jv6QUJ+6Li\r\nhFHBTtE92guh+a5NARhZw8YvPE/4+pd5DDWUFm87RIRbcyVkLJYN4Ff7s4Hf\r\n4JNJed4CQ9Motx6fl14KdJXKgMevlOBpq4c=\r\n=JoYk\r\n-----END PGP SIGNATURE-----\r\n","size":86456,"noattachment":false,"key":"/quickbit-universal/-/quickbit-universal-1.2.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.2.2_1663765765779_0.8547606274381097"},"_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":1663765766028,"_cnpm_publish_time":1663765766028,"dist-tags":{"latest":"2.2.1"}}