Skip to main content

Type Alias: MappedTableField<T>

MappedTableField<T> = object

Defined in: lib/markdown.ts:259

A mapped table field. A field with a label and a mapping function.

Example

const items = [{name: 'Alice', age: 30}, {name: 'Bob', age: 40}];
console.log(table(items, [{label: 'Name', mapFn: (el) => el.name}, {label: 'Dog Age', mapFn: (el) => el.age * 7}]));
// Prints:
//
// | Name | Age |
// | ---- | --- |
// | Alice | 210 |
// | Bob | 280 |

Type Parameters

T

T

The type of the objects in the array in the table.

Properties

label

label: string

Defined in: lib/markdown.ts:260


mapFn

mapFn: (el) => string | { toString: string; }

Defined in: lib/markdown.ts:261

Parameters

el

T

Returns

string | { toString: string; }