Skip to content

Commit

Permalink
fix: revert changes of stop-184 (#147)
Browse files Browse the repository at this point in the history
* fix: Optimised code for performance

* fix: changes in logic for resolve test case issue

* fix: performance issue for decycle

* fix(build): fixing module build

* fix: reverting changes for 184
  • Loading branch information
SB-rohitdesai authored Sep 2, 2024
1 parent 38fdc62 commit c21f39c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/decycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { pathToPointer } from './pathToPointer';

export const decycle = (obj: unknown, replacer?: (value: any) => any) => {
const objs = new WeakMap<object, string>();
const processedObjs = new WeakSet<object>();

return (function derez(value: any, path: string[]) {
// The new object or array
let curObj: any;
Expand All @@ -30,10 +28,7 @@ export const decycle = (obj: unknown, replacer?: (value: any) => any) => {
curObj[name] = derez(value[name], [...path, name]);
});
}
if (!processedObjs.has(value)) {
objs.delete(value);
}
processedObjs.add(value);
objs.delete(value);
return curObj;
}
return value;
Expand Down

0 comments on commit c21f39c

Please sign in to comment.