Skip to content
/ qp-n8n Public
forked from n8n-io/n8n

Commit

Permalink
fix(core): Do not user util.types.isProxy for tracking of augmented…
Browse files Browse the repository at this point in the history
… objects (n8n-io#5836)
  • Loading branch information
OlegIvaniv authored and sunilrr committed Apr 24, 2023
1 parent d7a7c9f commit 37cdcdc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/workflow/src/AugmentObject.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 37cdcdc

Please sign in to comment.