@dra2020/baseclient 1.0.51 → 1.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/baseclient.js +60 -0
- package/dist/baseclient.js.map +1 -1
- package/dist/util/all.d.ts +1 -0
- package/dist/util/bitset.d.ts +10 -0
- package/lib/util/all.ts +1 -0
- package/lib/util/bitset.ts +49 -0
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -9251,6 +9251,7 @@ __exportStar(__webpack_require__(/*! ./countedhash */ "./lib/util/countedhash.ts
|
|
|
9251
9251
|
__exportStar(__webpack_require__(/*! ./indexedarray */ "./lib/util/indexedarray.ts"), exports);
|
|
9252
9252
|
__exportStar(__webpack_require__(/*! ./gradient */ "./lib/util/gradient.ts"), exports);
|
|
9253
9253
|
__exportStar(__webpack_require__(/*! ./bintrie */ "./lib/util/bintrie.ts"), exports);
|
|
9254
|
+
__exportStar(__webpack_require__(/*! ./bitset */ "./lib/util/bitset.ts"), exports);
|
|
9254
9255
|
|
|
9255
9256
|
|
|
9256
9257
|
/***/ }),
|
|
@@ -9712,6 +9713,65 @@ class BinTrieBuilder {
|
|
|
9712
9713
|
exports.BinTrieBuilder = BinTrieBuilder;
|
|
9713
9714
|
|
|
9714
9715
|
|
|
9716
|
+
/***/ }),
|
|
9717
|
+
|
|
9718
|
+
/***/ "./lib/util/bitset.ts":
|
|
9719
|
+
/*!****************************!*\
|
|
9720
|
+
!*** ./lib/util/bitset.ts ***!
|
|
9721
|
+
\****************************/
|
|
9722
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
9723
|
+
|
|
9724
|
+
|
|
9725
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9726
|
+
exports.ListToBitset = void 0;
|
|
9727
|
+
const BitLookup = [1, 2, 4, 8, 16, 32, 64, 128];
|
|
9728
|
+
class ListToBitset {
|
|
9729
|
+
constructor(list) {
|
|
9730
|
+
this.list = list;
|
|
9731
|
+
this.index = {};
|
|
9732
|
+
this.size = Math.floor((this.list.length + 7) / 8);
|
|
9733
|
+
this.list.forEach((s, i) => { this.index[s] = i; });
|
|
9734
|
+
}
|
|
9735
|
+
toBits(l) {
|
|
9736
|
+
let ab = new ArrayBuffer(this.size);
|
|
9737
|
+
let u8 = new Uint8Array(ab);
|
|
9738
|
+
if (l)
|
|
9739
|
+
l.forEach(s => {
|
|
9740
|
+
let n = this.index[s];
|
|
9741
|
+
let i = Math.floor(n / 8);
|
|
9742
|
+
u8[i] |= BitLookup[n % 8];
|
|
9743
|
+
});
|
|
9744
|
+
return u8;
|
|
9745
|
+
}
|
|
9746
|
+
toList(u8) {
|
|
9747
|
+
let list = [];
|
|
9748
|
+
for (let i = 0; i < u8.length; i++) {
|
|
9749
|
+
let u = u8[i];
|
|
9750
|
+
if (u) {
|
|
9751
|
+
if (u & 1)
|
|
9752
|
+
list.push(this.list[i * 8 + 0]);
|
|
9753
|
+
if (u & 2)
|
|
9754
|
+
list.push(this.list[i * 8 + 1]);
|
|
9755
|
+
if (u & 4)
|
|
9756
|
+
list.push(this.list[i * 8 + 2]);
|
|
9757
|
+
if (u & 8)
|
|
9758
|
+
list.push(this.list[i * 8 + 3]);
|
|
9759
|
+
if (u & 16)
|
|
9760
|
+
list.push(this.list[i * 8 + 4]);
|
|
9761
|
+
if (u & 32)
|
|
9762
|
+
list.push(this.list[i * 8 + 5]);
|
|
9763
|
+
if (u & 64)
|
|
9764
|
+
list.push(this.list[i * 8 + 6]);
|
|
9765
|
+
if (u & 128)
|
|
9766
|
+
list.push(this.list[i * 8 + 7]);
|
|
9767
|
+
}
|
|
9768
|
+
}
|
|
9769
|
+
return list;
|
|
9770
|
+
}
|
|
9771
|
+
}
|
|
9772
|
+
exports.ListToBitset = ListToBitset;
|
|
9773
|
+
|
|
9774
|
+
|
|
9715
9775
|
/***/ }),
|
|
9716
9776
|
|
|
9717
9777
|
/***/ "./lib/util/countedhash.ts":
|