@andrew_l/toolkit 0.3.5 → 0.3.6
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/index.cjs +45 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -3
- package/dist/index.d.mts +28 -3
- package/dist/index.d.ts +28 -3
- package/dist/index.mjs +43 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -832,7 +832,7 @@ function uniqBy(array, comparator) {
|
|
|
832
832
|
});
|
|
833
833
|
}
|
|
834
834
|
|
|
835
|
-
class
|
|
835
|
+
class AssertionError extends Error {
|
|
836
836
|
/**
|
|
837
837
|
* Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
|
|
838
838
|
*/
|
|
@@ -863,17 +863,6 @@ class BrowserAssertionError extends Error {
|
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
865
|
|
|
866
|
-
let AssertionError = BrowserAssertionError;
|
|
867
|
-
if (isNode()) {
|
|
868
|
-
try {
|
|
869
|
-
const assert = require("node:assert");
|
|
870
|
-
if (assert.AssertionError) {
|
|
871
|
-
AssertionError = assert.AssertionError;
|
|
872
|
-
}
|
|
873
|
-
} catch {
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
|
|
877
866
|
function ok(value, message) {
|
|
878
867
|
if (!value) {
|
|
879
868
|
throw toError$1(
|
|
@@ -2193,6 +2182,47 @@ function concatenateBytes(a, b) {
|
|
|
2193
2182
|
return result;
|
|
2194
2183
|
}
|
|
2195
2184
|
|
|
2185
|
+
function rleDecode(buf, value = 0) {
|
|
2186
|
+
const result = [];
|
|
2187
|
+
let i = 0;
|
|
2188
|
+
while (i < buf.length) {
|
|
2189
|
+
if (buf[i] === value) {
|
|
2190
|
+
const count = buf[i + 1];
|
|
2191
|
+
for (let j = 0; j < count; j++) {
|
|
2192
|
+
result.push(value);
|
|
2193
|
+
}
|
|
2194
|
+
i += 2;
|
|
2195
|
+
} else {
|
|
2196
|
+
result.push(buf[i]);
|
|
2197
|
+
i++;
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
return new Uint8Array(result);
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
function rleEncode(buf, value = 0) {
|
|
2204
|
+
const result = [];
|
|
2205
|
+
let i = 0;
|
|
2206
|
+
while (i < buf.length) {
|
|
2207
|
+
if (buf[i] === value) {
|
|
2208
|
+
const runStart = i;
|
|
2209
|
+
while (i < buf.length && buf[i] === value) {
|
|
2210
|
+
i++;
|
|
2211
|
+
}
|
|
2212
|
+
let runLength = i - runStart;
|
|
2213
|
+
while (runLength > 0) {
|
|
2214
|
+
const chunk = Math.min(runLength, 255);
|
|
2215
|
+
result.push(value, chunk);
|
|
2216
|
+
runLength -= chunk;
|
|
2217
|
+
}
|
|
2218
|
+
} else {
|
|
2219
|
+
result.push(buf[i]);
|
|
2220
|
+
i++;
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
return new Uint8Array(result);
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2196
2226
|
function uint16ToUint8(value) {
|
|
2197
2227
|
const uint8Array = new Uint8Array(value.length * 2);
|
|
2198
2228
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -6011,8 +6041,8 @@ function withResolve(fn, getCacheKey) {
|
|
|
6011
6041
|
}
|
|
6012
6042
|
|
|
6013
6043
|
exports.AppError = AppError;
|
|
6044
|
+
exports.AssertionError = AssertionError;
|
|
6014
6045
|
exports.AsyncIterableQueue = AsyncIterableQueue;
|
|
6015
|
-
exports.BrowserAssertionError = BrowserAssertionError;
|
|
6016
6046
|
exports.CancellablePromise = CancellablePromise;
|
|
6017
6047
|
exports.ColorParser = ColorParser;
|
|
6018
6048
|
exports.EJSON = instance;
|
|
@@ -6198,6 +6228,8 @@ exports.randomString = randomString;
|
|
|
6198
6228
|
exports.removeVS16s = removeVS16s;
|
|
6199
6229
|
exports.retryOnError = retryOnError;
|
|
6200
6230
|
exports.rgbToChannels = rgbToChannels;
|
|
6231
|
+
exports.rleDecode = rleDecode;
|
|
6232
|
+
exports.rleEncode = rleEncode;
|
|
6201
6233
|
exports.round2digits = round2digits;
|
|
6202
6234
|
exports.secondsToHm = secondsToHm;
|
|
6203
6235
|
exports.set = set;
|