snap-on-openapi 1.0.28 → 1.0.29
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.
- package/dist/services/Logger/Logger.js +26 -24
- package/package.json +1 -1
|
@@ -57,25 +57,25 @@ export class Logger {
|
|
|
57
57
|
if (typeof data !== 'object') {
|
|
58
58
|
return data;
|
|
59
59
|
}
|
|
60
|
-
const seen = new
|
|
61
|
-
|
|
60
|
+
const recurse = (obj, path = ['self'], seen = new Map()) => {
|
|
61
|
+
const currentPath = path.join('.');
|
|
62
|
+
seen.set(obj, currentPath);
|
|
62
63
|
if (Array.isArray(obj)) {
|
|
63
64
|
const result = [];
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
obj.forEach((val, index) => {
|
|
66
|
+
if (typeof val === 'object' && val !== null) {
|
|
67
|
+
const existingPath = seen.get(val);
|
|
68
|
+
if (existingPath) {
|
|
69
|
+
result.push(`circular->${existingPath === 'self' ? 'self' : existingPath.replace('self.', '')}`);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
result.push(recurse(val, [...path, index.toString()], new Map(seen)));
|
|
71
73
|
}
|
|
72
|
-
seen.add(val);
|
|
73
|
-
const newPath = [...path, index.toString()];
|
|
74
|
-
result.push(recurse(val, newPath));
|
|
75
|
-
continue;
|
|
76
74
|
}
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
else {
|
|
76
|
+
result.push(val);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
79
|
return result;
|
|
80
80
|
}
|
|
81
81
|
if (obj instanceof Date) {
|
|
@@ -83,17 +83,19 @@ export class Logger {
|
|
|
83
83
|
}
|
|
84
84
|
const result = {};
|
|
85
85
|
for (const key of Object.keys(obj)) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
const val = obj[key];
|
|
87
|
+
if (typeof val === 'object' && val !== null) {
|
|
88
|
+
const existingPath = seen.get(val);
|
|
89
|
+
if (existingPath) {
|
|
90
|
+
result[key] = `circular->${existingPath === 'self' ? 'self' : existingPath.replace('self.', '')}`;
|
|
90
91
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
else {
|
|
93
|
+
result[key] = recurse(val, [...path, key], new Map(seen));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
result[key] = val;
|
|
95
98
|
}
|
|
96
|
-
result[key] = obj[key];
|
|
97
99
|
}
|
|
98
100
|
return result;
|
|
99
101
|
};
|
package/package.json
CHANGED