Bug Fix: OHIF Study Metadata API implementation not correctly reading Study and Series level data + Adding ES5.1 properties to Study Metadata API abstract classes to prevent protected attribute override

This commit is contained in:
Emanuel F. Oliveira authored and Eloízio Salgado committed 2017-03-02 10:16:09 -03:00
1 parent 5d5df29e09
commit 2b22aecc15
8 files changed
+140 -38

No files matched your search

@@ -6,6 +6,7 @@
const STRING = 'string';
const NUMBER = 'number';
const FUNCTION = 'function';
const OBJECT = 'object';
export class Metadata {
@@ -14,7 +15,14 @@ export class Metadata {
*/
constructor(data) {
this._data = data;
// Define the main "_data" private property as an immutable property.
// IMPORTANT: This property can only be set during instance construction.
Object.defineProperty(this, '_data', {
configurable: false,
enumerable: false,
writable: false,
value: data
});
}
getData() {
@@ -24,7 +32,7 @@ export class Metadata {
getDataProperty(propertyName) {
let propertyValue;
const _data = this._data;
if (_data instanceof Object || typeof _data === 'object' && _data !== null) {
if (_data instanceof Object || typeof _data === OBJECT && _data !== null) {
propertyValue = _data[propertyName];
}
return propertyValue;