0.0.4 • Published 6 months ago

@types/html-tableify v0.0.4

Weekly downloads
8
License
MIT
Repository
github
Last release
6 months ago

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

// Type definitions for html-tableify 0.0
// Project: https://github.com/LingyuCoder/html-tableify#readme
// Definitions by: Ciarán Ingle <https://github.com/inglec-arista>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/**
 * 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: Thu, 08 Jul 2021 14:22:55 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Ciarán Ingle.

0.0.3

7 months ago

0.0.2

8 months ago

0.0.4

6 months ago

0.0.1

3 years ago

0.0.0

4 years ago