How to use the @azure-tools/codegen.joinComma function in @azure-tools/codegen

To help you get started, we’ve selected a few @azure-tools/codegen examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / autorest.go / src / generator / protocol / models.ts View on Github external
text += `${comment(enm.language.go!.name, '// ')} - ${enm.language.go!.description}\n`;
    }
    text += `type ${enm.language.go!.name} ${enm.choiceType.language.go!.name}\n\n`;
    enm.choices.sort((a: ChoiceValue, b: ChoiceValue) => { return SortAscending(a.language.go!.name, b.language.go!.name); });
    const vals = new Array();
    text += 'const (\n'
    for (const val of values(enm.choices)) {
      if (HasDescription(val.language.go!)) {
        text += `\t${comment(val.language.go!.name, '// ')} - ${val.language.go!.description}\n`;
      }
      text += `\t${val.language.go!.name} ${enm.language.go!.name} = "${val.value}"\n`;
      vals.push(val.language.go!.name);
    }
    text += ")\n\n"
    text += `func ${enm.language.go!.possibleValuesFunc}() []${enm.language.go!.name} {\n`;
    text += `\treturn []${enm.language.go!.name}{${joinComma(vals, (item: string) => item)}}\n`;
    text += '}\n\n';
  }
  return text;
}