|
|
@@ -253,20 +253,13 @@ lasagne.Metadata = class {
|
|
|
constructor(data) {
|
|
|
this._map = new Map();
|
|
|
if (data) {
|
|
|
- const items = JSON.parse(data);
|
|
|
- if (items) {
|
|
|
- for (const item of items) {
|
|
|
- if (item.name && item.schema) {
|
|
|
- item.schema.name = item.name;
|
|
|
- this._map.set(item.name, item.schema);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ const metadata = JSON.parse(data);
|
|
|
+ this._map = new Map(metadata.map((item) => [ item.name, item ]));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
type(name) {
|
|
|
- return this._map.has(name) ? this._map.get(name) : null;
|
|
|
+ return this._map.get(name);
|
|
|
}
|
|
|
|
|
|
attribute(type, name) {
|