This commit is contained in:
Simon Knott 2025-02-27 14:52:11 +01:00
parent 1837b1bf4b
commit ee70854b8e
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -71,7 +71,7 @@ export function source() {
}
}
const typedArrayCtors: Record<TypedArrayKind, Function> = {
const typedArrayConstructors: Record<TypedArrayKind, Function> = {
i8: Int8Array,
ui8: Uint8Array,
ui8c: Uint8ClampedArray,
@ -159,7 +159,7 @@ export function source() {
if ('h' in value)
return handles[value.h];
if ('ta' in value)
return base64ToTypedArray(value.ta.b, typedArrayCtors[value.ta.k]);
return base64ToTypedArray(value.ta.b, typedArrayConstructors[value.ta.k]);
}
return value;
}
@ -227,7 +227,7 @@ export function source() {
return { u: value.toJSON() };
if (isRegExp(value))
return { r: { p: value.source, f: value.flags } };
for (const [k, ctor] of Object.entries(typedArrayCtors) as [TypedArrayKind, Function][]) {
for (const [k, ctor] of Object.entries(typedArrayConstructors) as [TypedArrayKind, Function][]) {
if (value instanceof ctor)
return { ta: { b: typedArrayToBase64(value), k } };
}