diff --git a/src/core/services/utils/utils.ts b/src/core/services/utils/utils.ts index df4ca3209eb..bde2d0049ba 100644 --- a/src/core/services/utils/utils.ts +++ b/src/core/services/utils/utils.ts @@ -667,17 +667,10 @@ export class CoreUtilsProvider { * @param data Object. * @param prefix Prefix to add. * @returns Prefixed object. - * @deprecated since 5.0. Not used anymore + * @deprecated since 5.0. Use CoreObject.prefixKeys instead. */ prefixKeys(data: Record, prefix: string): Record { - const newObj = {}; - const keys = Object.keys(data); - - keys.forEach((key) => { - newObj[prefix + key] = data[key]; - }); - - return newObj; + return CoreObject.prefixKeys(data, prefix); } /** diff --git a/src/core/singletons/object.ts b/src/core/singletons/object.ts index 5ed742f1f7c..3b0d0dbba09 100644 --- a/src/core/singletons/object.ts +++ b/src/core/singletons/object.ts @@ -390,6 +390,24 @@ export class CoreObject { return result; } + /** + * Add a prefix to all the keys in an object. + * + * @param data Object. + * @param prefix Prefix to add. + * @returns Prefixed object. + */ + static prefixKeys(data: Record, prefix: string): Record { + const newObj = {}; + const keys = Object.keys(data); + + keys.forEach((key) => { + newObj[prefix + key] = data[key]; + }); + + return newObj; + } + /** * Function to enumerate enum keys. *