chore: cleanup parameters part 2/*

pull/413/head
Webber 2022-08-24 01:23:22 +02:00
parent fa479f532a
commit 48598c1f73
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,18 @@
type ParameterOption<T> = {
cli: boolean;
env: boolean;
cfg: boolean;
defaultValue: T;
};
// Todo - use CLI lib to define this instead.
export class ParameterOptions {
static get region(): ParameterOption<string | number> {
return {
cli: true,
env: true,
cfg: true,
defaultValue: 'eu-west-2',
};
}
}

View File

@ -0,0 +1,14 @@
export class Parameter {
public static toUpperSnakeCase(input: string) {
if (input.toUpperCase() === input) return input;
return input.replace(/([\da-z])([A-Z])/g, '$1_$2').toUpperCase();
}
public static toCamelCase(input: string) {
return input
.split('_')
.map((word) => `${word[0].toUppercase()}${word.slice(1).toLowerCase()}`)
.join('');
}
}