@rxap/xml-parser
Version:
Provides a set of decorators and services for parsing and serializing XML documents into TypeScript classes. It simplifies the process of mapping XML elements and attributes to class properties, handling data validation, and serializing objects back into
15 lines • 849 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getExtendedTypes = getExtendedTypes;
const reflect_metadata_1 = require("@rxap/reflect-metadata");
const metadata_keys_1 = require("../decorators/metadata-keys");
function getExtendedTypes(type, known = [type]) {
var _a;
const extendedTypes = ((_a = (0, reflect_metadata_1.getOwnMetadata)(metadata_keys_1.ElementParserMetaData.EXTENDS, type)) !== null && _a !== void 0 ? _a : []).filter(k => !known.includes(k));
const newTypes = [];
for (const extendedType of extendedTypes) {
newTypes.push(...getExtendedTypes(extendedType, extendedTypes.concat(known)).filter(s => !known.includes(s)));
}
return extendedTypes.concat(newTypes).filter((v, index, self) => self.indexOf(v) === index);
}
//# sourceMappingURL=get-extended-types.js.map