MOBILE-4653 chore: Move deprecated useful function
parent
84781a7658
commit
aca63d64fa
|
@ -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<string, unknown>, prefix: string): Record<string, unknown> {
|
||||
const newObj = {};
|
||||
const keys = Object.keys(data);
|
||||
|
||||
keys.forEach((key) => {
|
||||
newObj[prefix + key] = data[key];
|
||||
});
|
||||
|
||||
return newObj;
|
||||
return CoreObject.prefixKeys(data, prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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<string, unknown>, prefix: string): Record<string, unknown> {
|
||||
const newObj = {};
|
||||
const keys = Object.keys(data);
|
||||
|
||||
keys.forEach((key) => {
|
||||
newObj[prefix + key] = data[key];
|
||||
});
|
||||
|
||||
return newObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to enumerate enum keys.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue