1
0
mirror of https://github.com/koloml/furbooru-tagging-assistant.git synced 2025-12-24 07:12:57 +00:00

Added debug section to inspect extension's local storage

This commit is contained in:
2024-08-12 19:37:35 +04:00
parent f9cb73bafc
commit 68d1d726af
7 changed files with 189 additions and 0 deletions

23
src/lib/utils.js Normal file
View File

@@ -0,0 +1,23 @@
/**
* Traverse and find the object using the key path.
* @param {Object} targetObject Target object to traverse into.
* @param {string[]} path Path of keys to traverse deep into the object.
* @return {Object|null} Resulting object or null if nothing found (or target entry is not an object.
*/
export function findDeepObject(targetObject, path) {
let result = targetObject;
for (let key of path) {
if (!result || typeof result !== 'object') {
return null;
}
result = result[key];
}
if (!result || typeof result !== "object") {
return null;
}
return result;
}