Every line of 'enum in node js' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
606 function Enum(name, astNode, description, isPrivate) { 607 _super.call(this, name); 608 609 this.astNode = astNode; 610 611 this.description = description; 612 613 this.isPrivate = isPrivate; 614 615 this.members = []; 616 }
262 export function printEnum(definition, name) { 263 const { values, description, directives } = definition; 264 265 const dirStr = directives ? printTypeDirectives(directives) : ''; 266 const valStr = printValues(values); 267 const enumStr = `enum ${name}${dirStr} {\n${valStr}\n}\n`; 268 269 return typeof description === 'string' && description !== '' ? 270 `# ${description}\n${enumStr}` : 271 enumStr; 272 }
121 export function ccenum (enumx) { 122 if ('__enums__' in enumx) { 123 return; 124 } 125 value(enumx, '__enums__', null, true); 126 }
208 export function generateEnumNode( 209 ctx: CodeGeneratorFileContext, 210 node: s.Node 211 ): void { 212 trace("generateEnumNode(%s) [%s]", node, node.getDisplayName()); 213 214 const members = node 215 .getEnum() 216 .getEnumerants() 217 .toArray() 218 .sort(compareCodeOrder) 219 .map(e => ts.createEnumMember(util.c2s(e.getName()))); 220 const d = ts.createEnumDeclaration( 221 __, 222 [EXPORT], 223 getFullClassName(node), 224 members 225 ); 226 227 ctx.statements.push(d); 228 }
31 value: function parse(node) { 32 return this.parseEnum(node['enum']); 33 }
172 private _compileEnumDeclaration(node: ts.EnumDeclaration): string { 173 const name = this.getName(node.name); 174 const members: string[] = node.members.map(m => 175 ` "${this.getName(m.name)}": ${getTextOfConstantValue(this.checker.getConstantValue(m))},\n`); 176 this.exportedNames.push(name); 177 return `export const ${name} = t.enumtype({\n${members.join("")}});`; 178 }
21 public supportsNode(node: ts.EnumDeclaration | ts.EnumMember): boolean { 22 return node.kind === ts.SyntaxKind.EnumDeclaration || node.kind === ts.SyntaxKind.EnumMember; 23 }
1 function Enum(type, intValue, name, displayName) { 2 this.intValue = intValue; 3 this.displayName = displayName; 4 this.name = name; 5 this.type = type; 6 }