MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / fromJSON

Method fromJSON

src/theme/builder.js:326–344  ·  view source on GitHub ↗
(theme)

Source from the content-addressed store, hash-verified

324 }
325
326 static fromJSON(theme) {
327 if (!theme) throw new Error("Theme is required");
328 if (typeof theme !== "object") throw new Error("Theme must be an object");
329 if (!theme.name) throw new Error("Theme name is required");
330 if (!theme.type) throw new Error("Theme type is required");
331 if (!theme.version) throw new Error("Theme version is required");
332 const themeBuilder = new ThemeBuilder(
333 theme.name,
334 theme.type,
335 theme.version,
336 );
337
338 Object.keys(theme).forEach((key) => {
339 if (!Object.getOwnPropertyDescriptor(ThemeBuilder.prototype, key)) return;
340 themeBuilder[key] = theme[key];
341 });
342
343 return themeBuilder;
344 }
345
346 /**
347 *

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected