UNPKG

@nodecfdi/cfdi-cleaner

Version:

Librería para limpiar comprobantes fiscales digitales v3.3 y v4.0

17 lines (16 loc) 738 B
import { Mixin } from 'ts-mixer'; import XmlElementMethods from '#src/mixins/xml_element_methods'; export default class RemoveAddenda extends Mixin(XmlElementMethods) { clean(document) { this.removeAddendas(document, 'http://www.sat.gob.mx/cfd/3'); this.removeAddendas(document, 'http://www.sat.gob.mx/cfd/4'); this.removeAddendas(document, 'http://www.sat.gob.mx/esquemas/retencionpago/2'); this.removeAddendas(document, 'http://www.sat.gob.mx/esquemas/retencionpago/1'); } removeAddendas(document, namespace) { const addendas = document.getElementsByTagNameNS(namespace, 'Addenda'); for (const element of addendas) { this.elementRemove(element); } } }