@nodecfdi/cfdi-core
Version:
Librería que contiene las herramientas base para trabajar con CFDI's
66 lines (62 loc) • 2.48 kB
TypeScript
declare class XmlAttributes {
private readonly _attributes;
constructor(attributes?: Record<string, unknown>);
get size(): number;
get length(): number;
get(name: string): string;
set(name: string, value?: string | null): this;
delete(name: string): boolean;
clear(): this;
has(name: string): boolean;
import(attributes: Record<string, unknown>): this;
export(): Record<string, string>;
exportMap(): Map<string, string>;
forEach(callbackFn: (value: string, key: string, map: Map<string, string>) => void, thisArgument?: unknown): void;
entries(): IterableIterator<[string, string]>;
keys(): IterableIterator<string>;
values(): IterableIterator<string>;
[Symbol.iterator](): IterableIterator<[string, string]>;
readonly [Symbol.toStringTag] = "XmlAttributes";
private castValueToString;
}
declare class XmlNodes extends Array<XmlNodeInterface> {
private readonly _sorter;
constructor(nodes?: XmlNodeInterface[]);
static get [Symbol.species](): ArrayConstructor;
add(...nodes: XmlNodeInterface[]): this;
delete(node: XmlNodeInterface): this;
clear(): this;
has(node: XmlNodeInterface): boolean;
first(): XmlNodeInterface | undefined;
get(position: number): XmlNodeInterface;
firstNodeWithName(nodeName: string): XmlNodeInterface | undefined;
getNodesByName(nodeName: string): XmlNodes;
order(): void;
/**
* It takes only the unique string names and sort using the order of appearance.
*/
setOrder(names: string[]): void;
getOrder(): string[];
importFromArray(nodes: XmlNodeInterface[]): this;
}
interface XmlNodeInterface {
addAttributes(attributes: Record<string, unknown>): void;
addChild(node: XmlNodeInterface): XmlNodeInterface;
attributes(): XmlAttributes;
setAttribute(name: string, value?: string | null): void;
getAttribute(name: string): string;
hasAttribute(name: string): boolean;
children(): XmlNodes;
clear(): void;
length: number;
name(): string;
searchAttribute(...searchPath: string[]): string;
searchNode(...searchPath: string[]): XmlNodeInterface | undefined;
searchNodes(...searchPath: string[]): XmlNodes;
setValue(value: string): void;
value(): string;
cdata(): string;
setCData(cdata: string): void;
[Symbol.iterator](): IterableIterator<XmlNodeInterface>;
}
export { type XmlNodeInterface as X, XmlNodes as a, XmlAttributes as b };