Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 9x 9x 9x 9x 9x 1x 9x | /**
* Returns a formatted repository name that complies with AWS CloudFormation stack naming requirements.
* Stack names must match the regular expression: /^[A-Za-z][A-Za-z0-9-]*$/
*/
export function formatRepoNameForCloudFormation(repoName: string): string {
let formattedName = repoName.toLowerCase();
formattedName = formattedName.replace(/[^A-Za-z0-9]/g, "-");
formattedName = formattedName.replace(/-+/g, "-");
formattedName = formattedName.replace(/^-|-$/g, "");
if (!/^[A-Za-z]/.test(formattedName)) {
formattedName = `r-${formattedName}`;
}
return formattedName;
}
|