UNPKG

@web-atoms/core

Version:
43 lines (42 loc) 1.26 kB
System.register(["../di/TypeKey"], function (_export, _context) { "use strict"; var TypeKey, PropertyMap; _export("PropertyMap", void 0); return { setters: [function (_diTypeKey) { TypeKey = _diTypeKey.TypeKey; }], execute: function () { _export("PropertyMap", PropertyMap = class PropertyMap { static from(o) { const c = Object.getPrototypeOf(o); const key = TypeKey.get(c); const map = PropertyMap.map; const m = map[key] || (map[key] = PropertyMap.createMap(o)); return m; } static createMap(c) { const map = {}; const nameList = []; while (c) { const names = Object.getOwnPropertyNames(c); for (const name of names) { if (/hasOwnProperty|constructor|toString|isValid|errors/i.test(name)) { continue; } map[name] = true; nameList.push(name); } c = Object.getPrototypeOf(c); } const m = new PropertyMap(); m.map = map; m.names = nameList; return m; } }); PropertyMap.map = {}; } }; }); //# sourceMappingURL=PropertyMap.js.map