Hacky Yaak import complete!

This commit is contained in:
Gregory Schier
2023-11-09 19:40:31 -08:00
parent b535722acd
commit 4b89b95738
15 changed files with 246 additions and 197 deletions

View File

@@ -0,0 +1,20 @@
export function pluginHookImport(contents) {
let parsed;
try {
parsed = JSON.parse(contents);
} catch (err) {
return undefined;
}
if (!isJSObject(parsed)) {
return undefined;
}
if (parsed.yaakSchema !== 1) return undefined;
return parsed.resources; // Should already be in the correct format
}
export function isJSObject(obj) {
return Object.prototype.toString.call(obj) === '[object Object]';
}