mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 01:57:45 +03:00
fix(core): Do not user util.types.isProxy
for tracking of augmented objects (#5836)
This commit is contained in:
parent
d86e693019
commit
aacbb54bef
@ -1,15 +1,18 @@
|
||||
import type { IDataObject } from './Interfaces';
|
||||
import util from 'util';
|
||||
|
||||
const augmentedObjects = new WeakSet<object>();
|
||||
function augment<T>(value: T): T {
|
||||
if (
|
||||
typeof value !== 'object' ||
|
||||
value === null ||
|
||||
util.types.isProxy(value) ||
|
||||
value instanceof RegExp
|
||||
value instanceof RegExp ||
|
||||
augmentedObjects.has(value)
|
||||
)
|
||||
return value;
|
||||
|
||||
// Track augmented objects to prevent infinite recursion in cases where an object contains circular references
|
||||
augmentedObjects.add(value);
|
||||
|
||||
if (value instanceof Date) return new Date(value.valueOf()) as T;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
|
Loading…
Reference in New Issue
Block a user