@aurigma/design-atoms-model
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
32 lines • 1.19 kB
JavaScript
var ItemsMetadata = /** @class */ (function () {
function ItemsMetadata() {
this.data = {};
this._typeDictionary = {};
}
ItemsMetadata.prototype.getPropertyMetadata = function (item, property) {
var type = item["type"];
if (type == null)
return null;
if (this._typeDictionary[type] == null) {
this._typeDictionary[type] = [];
var prototype = item;
while (prototype.constructor.type != null) {
this._typeDictionary[type].push(prototype.constructor.type);
prototype = Object.getPrototypeOf(prototype);
}
}
for (var i = 0; i < this._typeDictionary[type].length; i++) {
var dictType = this._typeDictionary[type][i];
if (this.data[dictType] != null) {
var result = this.data[dictType][property];
if (result != null)
return result;
}
}
return null;
};
return ItemsMetadata;
}());
export { ItemsMetadata };
export var itemsMetadata = new ItemsMetadata();
//# sourceMappingURL=ItemsMetadata.js.map