Hacky Yaak import complete!

This commit is contained in:
Gregory Schier committed 2023-11-09 19:40:31 -08:00
1 parent b535722acd
commit 4b89b95738
15 files changed
+246 -197

No files matched your search

@@ -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]';
}