(theme)
| 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 | * |
nothing calls this directly
no outgoing calls
no test coverage detected