@deployport/specular-runtime
Version:
Runtime for Specular API clients with support for Node.js and Browser
18 lines (17 loc) • 471 B
JavaScript
export default class Enum {
name;
package;
constants = [];
defaultConstant;
constructor(pkg, name, constants) {
this.package = pkg;
this.name = name;
this.constants = constants;
const defaultConstant = constants[0];
if (!defaultConstant) {
throw new Error(`Enum ${name} must have at least one constant`);
}
this.defaultConstant = defaultConstant;
pkg._addType(this);
}
}