@hisptz/react-ui
Version:
A collection of reusable complex DHIS2 react ui components.
34 lines (25 loc) • 901 B
JavaScript
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { cloneDeep } from "lodash";
import { uid } from "../../../core/utils";
export default class Legend {
constructor(_ref) {
let {
id,
legendDefinitionId
} = _ref;
_defineProperty(this, "id", void 0);
_defineProperty(this, "legendDefinitionId", void 0);
_defineProperty(this, "startValue", void 0);
_defineProperty(this, "endValue", void 0);
this.id = id !== null && id !== void 0 ? id : uid();
this.legendDefinitionId = legendDefinitionId;
}
static set(object, key, value) {
if (key) {
const updatedObject = cloneDeep(object);
updatedObject[key] = value;
return updatedObject;
}
return this;
}
}