Housekeeping
Some checks failed
Build / Build (push) Has been cancelled
Build / Diff output (push) Has been cancelled
Build / Deploy to Cloudflare Pages (3.114.6) (push) Has been cancelled
Build / Deploy to GitHub and GitLab (push) Has been cancelled

This commit is contained in:
SukkaW
2025-05-01 00:13:36 +08:00
parent d2acd39ad6
commit 331ea5a403
11 changed files with 114 additions and 220 deletions

View File

@@ -1,23 +0,0 @@
const MAX_BLOCK_SIZE = 65535; // max parameter array size for use in Webkit
export function appendArrayInPlace<T>(dest: T[], source: T[]) {
let offset = 0;
let itemsLeft = source.length;
if (itemsLeft <= MAX_BLOCK_SIZE) {
// eslint-disable-next-line prefer-spread -- performance
dest.push.apply(dest, source);
} else {
while (itemsLeft > 0) {
const pushCount = itemsLeft > MAX_BLOCK_SIZE ? MAX_BLOCK_SIZE : itemsLeft;
const subSource = source.slice(offset, offset + pushCount);
// eslint-disable-next-line prefer-spread -- performance
dest.push.apply(dest, subSource);
itemsLeft -= pushCount;
offset += pushCount;
}
}
return dest;
}
export const appendArrayInPlaceCurried = <T>(dest: T[]) => (source: T[]) => appendArrayInPlace(dest, source);