diff --git a/helpers/Toolbox.ts b/helpers/Toolbox.ts index 55fde4d28d156b4427731ee22971b3e8a4dd941b..f1b3974e247fe33d1a3f76ab46cfa81f2ec50227 100644 --- a/helpers/Toolbox.ts +++ b/helpers/Toolbox.ts @@ -42,6 +42,14 @@ class Toolbox { getTotalSize: this.getTotalSize.bind(this) }; } + + public snakeToCamel(str: string): string { + return str.toLowerCase().replace(/([-_][a-z])/g, (group: string) => group.toUpperCase().replace('-', '').replace('_', '')); + } + + public getKeysWithPrefix(obj: object, prefix: string): Array<string> { + return Object.keys(obj).filter(key => key.startsWith(prefix)); + } }