UNPKG

@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

20 lines 979 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getParentParsers = getParentParsers; const element_child_1 = require("./decorators/element-child"); const element_children_1 = require("./decorators/element-children"); const utilities_1 = require("./decorators/utilities"); const is_type_of_1 = require("./utilities/is-type-of"); function getParentParsers(instance, parent) { const parsers = (0, utilities_1.GetAllElementParserInstances)(parent.constructor); return parsers.filter((parser) => { if (parser instanceof element_child_1.ElementChildParser || parser instanceof element_children_1.ElementChildrenParser) { const elementType = parser.elementType; return (elementType && (0, is_type_of_1.isTypeOf)(typeof instance === 'function' ? instance : instance.constructor, elementType)); } return false; }); } //# sourceMappingURL=get-parent-parsers.js.map