feature: remember node positions after refreshing pages

This commit is contained in:
Cindy Chang
2024-07-01 10:39:53 +08:00
parent 69a3f27cb2
commit 24ccdd47ae
5 changed files with 60 additions and 40 deletions

15
src/utils/jsUtils.js Normal file
View File

@@ -0,0 +1,15 @@
export const printObject = (obj, indent = 0) => {
const padding = ' '.repeat(indent);
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
if (typeof obj[key] === 'object' && obj[key] !== null) {
console.log(`${padding}${key}: {`);
printObject(obj[key], indent + 2);
console.log(`${padding}}`);
} else {
console.log(`${padding}${key}: ${obj[key]}`);
}
}
}
}