chore: cleanup parameters part 2/*
parent
fa479f532a
commit
48598c1f73
|
|
@ -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',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -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('');
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue