fix(core): augmentObject should clone Buffer/Uint8Array instead of wrapping them in a proxy (#5902)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2023-04-04 14:34:24 +02:00 committed by GitHub
parent f4e59499fc
commit a72173414d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,7 @@ const augmentedObjects = new WeakSet<object>();
function augment<T>(value: T): T {
if (typeof value !== 'object' || value === null || value instanceof RegExp) return value;
if (value instanceof Date) return new Date(value.valueOf()) as T;
if (value instanceof Uint8Array) return value.slice() as T;
// eslint-disable-next-line @typescript-eslint/no-use-before-define
if (Array.isArray(value)) return augmentArray(value) as T;