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

0.0.4 • Public • Published

Installation

npm install --save @types/html-tableify

Summary

This package contains type definitions for html-tableify (https://github.com/LingyuCoder/html-tableify#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/html-tableify.

index.d.ts

/**
 * Create a HTML table from JSON data.
 *
 * @typeparam T Column name.
 * @param data Array of objects containing values for each key `T`. Each array element represents column data for one
 * row. Columns without a corresponding value appear as an empty cell in the row.
 * @param config Table configuration object for data of keys `T`.
 * @return HTML table string.
 */
declare function tableify<T extends keyof any>(data: Array<tableify.Datum<T>>, config?: tableify.Config<T>): string;

declare namespace tableify {
    type Alignment = "center" | "left" | "right";

    /** Object of optional values for each key `T`. */
    type Datum<T extends keyof any> = {
        [K in T]?: unknown;
    };

    /** Header config object for key `T`. */
    interface Header<T> {
        /** Key in data object. */
        name: T;

        /** Text align of the column. */
        align?: Alignment | undefined;
        /** Title of the column. */
        title?: string | undefined;
    }

    /** Table config object for data with keys `T`. */
    interface Config<T> {
        headers?: Array<Header<T>> | undefined;
        /** Tidy the output HTML. */
        tidy?: boolean | undefined;
    }
}

export = tableify;

Additional Details

  • Last updated: Tue, 07 Nov 2023 03:09:37 GMT
  • Dependencies: none

Credits

These definitions were written by Ciarán Ingle.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/html-tableify

Weekly Downloads

11

Version

0.0.4

License

MIT

Unpacked Size

5.03 kB

Total Files

5

Last publish

Collaborators

  • types