Use foxts more
Some checks failed
Build / Build (push) Has been cancelled
Build / Diff output (push) Has been cancelled
Build / Deploy to Cloudflare Pages (3.114.12) (push) Has been cancelled
Build / Deploy to GitHub and GitLab (push) Has been cancelled

This commit is contained in:
SukkaW
2025-10-10 05:01:58 +08:00
parent eb5a2c73bb
commit 8ccc5d6b5b
3 changed files with 3 additions and 22 deletions

View File

@@ -6,26 +6,6 @@ import { appendArrayInPlace } from 'foxts/append-array-in-place';
export type MaybePromise<T> = T | Promise<T>;
export function fastStringCompare(a: string, b: string) {
const lenA = a.length;
const lenB = b.length;
const minLen = lenA < lenB ? lenA : lenB;
for (let i = 0; i < minLen; ++i) {
const ca = a.charCodeAt(i);
const cb = b.charCodeAt(i);
if (ca > cb) return 1;
if (ca < cb) return -1;
}
if (lenA === lenB) {
return 0;
}
return lenA > lenB ? 1 : -1;
};
interface Write {
(
destination: string,