{"name":"quickbit-universal","version":"2.0.5","description":"Universal wrapper for libquickbit with a JavaScript fallback","main":"index.js","browser":{"./index.js":"./fallback.js"},"scripts":{"test":"standard && brittle test.mjs"},"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","simdle-universal":"^1.1.0","quickbit-native":"^2.0.3"},"optionalDependencies":{"quickbit-native":"^2.0.3"},"devDependencies":{"brittle":"^3.1.0","standard":"^17.0.0"},"gitHead":"047b9ca4c1e9ebb47579a0d40b970a61cfcb6d7c","_id":"quickbit-universal@2.0.5","_nodeVersion":"19.7.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-pVTWgwfl5smL+Y/tqPaV9TYRfzALO6Wf1SlHVGrTzapeFHm3s1JgdMsKuSQTp/zTB+cw4JcXc0JJFrPT6taJfQ==","shasum":"0aede9994ebff57a51c0edcf13e0e93e51ad6f3b","tarball":"http://registry-npm.ywwl.com/quickbit-universal/download/quickbit-universal-2.0.5.tgz","fileCount":5,"unpackedSize":13339,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEYMhK1ovlykC1A2ne3U2WvxmYyOV0+wV/qR+p/e4td9AiAEwhfqYjHZ1XD5R2pU9znbKzSUe8G4CPHjHa7dirhzmQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkHbusACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqlQg//W/cWf72kqx4GvVfr7bqRlqvmeGOSoVHkKjcMdmH8DkyxS2sj\r\n7D7z2VdtUfyYWEz5AzUKdrCl1mLSwnuGKhJ26/w/Dh2lNMGHikGUPxShGx4e\r\nP1iUod08G6C1lhzb/aiT8tjDIcPgBqcP3BdpYPN/fslzyu3lWtqBT4wwQcGI\r\n+xzAOMxzbI6DOWjliGeY3HeWkbDDJxnrrGFhFCJ895d+fDj72Wj1tuPOKKie\r\n3TG2l9PyDqAhbKPVjuarQ59z+FgT/IJ1nlF1LGfLaVOY5j9YCIQKTLTYR0dL\r\n7L29zm/zNHQgMbFCOVOk5C4S4xuvsKOyDh6x/a6aYoSvwaKr0hzmXEsk9RkS\r\nNWQv4EHUL/P8Y7xCoBc/ufhMSXMoYHubUtQun1Ux98y6QgWhIlJghIwFTIAb\r\nZXyCpNvtcaILOdxE1Qdg6OaIWHJF2pcXSX1+SRl3cInoHSQtvxMer1vsE1kv\r\nXaBE2dfkFekQMKTWZvyLMPnf9erdjYdnSQTLKVMT3z7l2vNNy135tuDEeYi3\r\nWrwIAcX7Z4rcm2ZBrLDSt0K7BLIaz8r4Tgioll4cH0DyJJoCCoteYYQwqycy\r\nAMSYa2Go/3F67FJqbkwt1r3L1tokoW4224Tf/krMsC+mmgPGVhAgaRYEQekb\r\n1hN44U49otxfSNEkMclqkadto6N35BFVHGA=\r\n=1n8Q\r\n-----END PGP SIGNATURE-----\r\n","size":3519,"noattachment":false,"key":"/quickbit-universal/-/quickbit-universal-2.0.5.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.5_1679670187823_0.6225697413581119"},"_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":1679670188032,"_cnpm_publish_time":1679670188032,"dist-tags":{"latest":"2.2.1"}}