Normally Palatable Mango

    @types/xml
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.8 • Public • Published

    Installation

    npm install --save @types/xml

    Summary

    This package contains type definitions for xml (https://github.com/dylang/node-xml).

    Details

    Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/xml.

    index.d.ts

    // Type definitions for xml 1.0
    // Project: https://github.com/dylang/node-xml
    // Definitions by: Jianrong Yu <https://github.com/YuJianrong>
    //                 Semyon Fomin <https://github.com/semyonf>
    // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
    
    /// <reference types="node" />
    
    declare namespace xml {
        interface Option {
            /**
             * String used for tab, defaults to no tabs (compressed)
             */
            indent?: string | undefined;
            /**
             * Return the result as a `stream` (default false)
             */
            stream?: boolean | undefined;
            /**
             * Add default xml declaration (default false)
             */
            declaration?:
                | boolean
                | {
                      encoding?: string | undefined;
                      standalone?: string | undefined;
                  } | undefined;
        }
    
        interface XmlAttrs {
            [attr: string]: XmlAtom;
        }
        interface XmlDescArray {
            [index: number]: { _attr: XmlAttrs } | XmlObject;
        }
        interface ElementObject {
            push(xmlObject: XmlObject): void;
            close(xmlObject?: XmlObject): void;
        }
    
        type XmlAtom = string | number | boolean | null;
        type XmlDesc =
            | { _attr: XmlAttrs }
            | { _cdata: string }
            | { _attr: XmlAttrs; _cdata: string }
            | XmlAtom
            | XmlAtom[]
            | XmlDescArray;
        type XmlObject = { [tag: string]: ElementObject | XmlDesc } | XmlDesc;
    
        function element(...xmlObjects: XmlObject[]): ElementObject;
        function Element(...xmlObjects: XmlObject[]): ElementObject;
    }
    
    declare function xml(
        xmlObject: xml.XmlObject | xml.XmlObject[],
        options: { stream: true } & xml.Option,
    ): NodeJS.ReadableStream;
    declare function xml(xmlObject?: xml.XmlObject | xml.XmlObject[], options?: boolean | string | xml.Option): string;
    
    export = xml;

    Additional Details

    • Last updated: Tue, 18 Jan 2022 20:31:26 GMT
    • Dependencies: @types/node
    • Global values: none

    Credits

    These definitions were written by Jianrong Yu, and Semyon Fomin.

    Keywords

    none

    Install

    npm i @types/xml

    DownloadsWeekly Downloads

    36,570

    Version

    1.0.8

    License

    MIT

    Unpacked Size

    6.53 kB

    Total Files

    4

    Last publish

    Collaborators

    • types