export interface Attributes { [key: string]: string | number | undefined } export interface DeclarationAttributes { version?: string | number encoding?: 'utf-8' | string standalone?: 'yes' | 'no' } export interface ElementCompact { [key: string]: any _declaration?: { _attributes?: DeclarationAttributes } _instruction?: { [key: string]: string } _attributes?: Attributes _cdata?: string _doctype?: string _comment?: string _text?: string | number } export interface Element { declaration?: { attributes?: DeclarationAttributes } instruction?: string attributes?: Attributes cdata?: string doctype?: string comment?: string text?: string | number | boolean type?: string name?: string elements?: Array } // eslint-disable-next-line @typescript-eslint/no-namespace export namespace Options { export interface XML2JSON extends XML2JS { spaces?: number | string } export interface XML2JS extends ChangingKeyNames, IgnoreOptions { compact?: boolean trim?: boolean sanitize?: boolean nativeType?: boolean addParent?: boolean alwaysArray?: boolean | Array alwaysChildren?: boolean instructionHasAttributes?: boolean captureSpacesBetweenElements?: boolean doctypeFn?: (value: string, parentElement: object) => void; instructionFn?: ( instructionValue: string, instructionName: string, parentElement: string ) => void; cdataFn?: (value: string, parentElement: object) => void; commentFn?: (value: string, parentElement: object) => void; textFn?: (value: string, parentElement: object) => void; instructionNameFn?: ( instructionName: string, instructionValue: string, parentElement: string ) => void; elementNameFn?: (value: string, parentElement: object) => void; attributeNameFn?: ( attributeName: string, attributeValue: string, parentElement: string ) => void; attributeValueFn?: ( attributeValue: string, attributeName: string, parentElement: string ) => void; attributesFn?: (value: string, parentElement: string) => void; } export interface JS2XML extends ChangingKeyNames, IgnoreOptions { spaces?: number | string compact?: boolean indentText?: boolean indentCdata?: boolean indentAttributes?: boolean indentInstruction?: boolean fullTagEmptyElement?: boolean noQuotesForNativeAttributes?: boolean doctypeFn?: (value: string, currentElementName: string, currentElementObj: object) => void; instructionFn?: ( instructionValue: string, instructionName: string, currentElementName: string, currentElementObj: object ) => void; cdataFn?: (value: string, currentElementName: string, currentElementObj: object) => void; commentFn?: (value: string, currentElementName: string, currentElementObj: object) => void; textFn?: (value: string, currentElementName: string, currentElementObj: object) => void; instructionNameFn?: ( instructionName: string, instructionValue: string, currentElementName: string, currentElementObj: object ) => void; elementNameFn?: (value: string, currentElementName: string, currentElementObj: object) => void; attributeNameFn?: ( attributeName: string, attributeValue: string, currentElementName: string, currentElementObj: object ) => void; attributeValueFn?: ( attributeValue: string, attributeName: string, currentElementName: string, currentElementObj: object ) => void; attributesFn?: (value: string, currentElementName: string, currentElementObj: object) => void; fullTagEmptyElementFn?: (currentElementName: string, currentElementObj: object) => void; } export interface IgnoreOptions { ignoreDeclaration?: boolean ignoreInstruction?: boolean ignoreAttributes?: boolean ignoreComment?: boolean ignoreCdata?: boolean ignoreDoctype?: boolean ignoreText?: boolean } export interface ChangingKeyNames { declarationKey?: string instructionKey?: string attributesKey?: string textKey?: string cdataKey?: string doctypeKey?: string commentKey?: string parentKey?: string typeKey?: string nameKey?: string elementsKey?: string } } /** * Internal representation of a fully-resolved options object where every key * has been normalised by the option helpers. Access is intentionally dynamic * (e.g. `options[type + 'Key']`) so a permissive index signature is used. */ export type InternalOptions = Record;