@mintlify/common 1.0.503 → 1.0.504
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import cloneDeepWith from 'lodash/cloneDeepWith.js';
|
|
2
2
|
export function truncateCircularReferences(value, numCycles = 0) {
|
|
3
3
|
const stack = [];
|
|
4
|
-
return
|
|
4
|
+
return cloneDeepWith(value, (val, _key, parent) => {
|
|
5
5
|
// pop any stack elements from other objects
|
|
6
6
|
while (stack.length && stack.at(-1) !== parent)
|
|
7
7
|
stack.pop();
|
|
@@ -17,7 +17,7 @@ export function truncateCircularReferences(value, numCycles = 0) {
|
|
|
17
17
|
function evaluateCircularReference(value, depth = 0) {
|
|
18
18
|
if (depth <= 0)
|
|
19
19
|
return {};
|
|
20
|
-
return
|
|
20
|
+
return cloneDeepWith(value, (val, _key, _obj, stack) => {
|
|
21
21
|
// we have reached a circular reference
|
|
22
22
|
if (stack && stack.has(val)) {
|
|
23
23
|
return evaluateCircularReference(val, depth - 1);
|