1 import _ from 'lodash';
3 export class CdHelperClass {
5 * Simple way to only update variables if they have really changed and not just the reference
7 * @param componentThis - In order to update the variables if necessary
8 * @param change - The variable name (attribute of the object) is followed by the current value
9 * it would update even if it equals
11 static updateChanged(componentThis: any, change: { [publicVarName: string]: any }) {
12 let hasChanges = false;
14 Object.keys(change).forEach((publicVarName) => {
15 const data = change[publicVarName];
16 if (!_.isEqual(data, componentThis[publicVarName])) {
17 componentThis[publicVarName] = data;
25 static cdVersionHeader(major_ver: string, minor_ver: string) {
26 return `application/vnd.ceph.api.v${major_ver}.${minor_ver}+json`;