Skip to content

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 (#5836)
  • Loading branch information
OlegIvaniv authored and netroy committed Mar 30, 2023
1 parent d19a973 commit 3e413f2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/workflow/src/AugmentObject.ts
@@ -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 3e413f2

Please sign in to comment.