ToTable
Convert an array to a nice table display. Usually, from the context.
- Type
- javascript
- Pack
- CommonScripts
Source
var data = args.data;
var headers = args.columns ? args.columns.split(',') : null;
if(!Array.isArray(data)) {
data = [data]
}
var flatData = [];
data.forEach(function(element) {
var flattenObject = treeToFlattenObject(element);
flatData.push(flattenObject);
});
return {Type: entryTypes.note, Contents: tableToMarkdown(args.title, flatData, headers), ContentsFormat: formats.markdown};
README
Converts an array in to a table display. Usually, from the context.
Script Data
| Name | Description |
|---|---|
| Script Type | javascript |
| Tags | Utility |
Inputs
| Argument Name | Description |
|---|---|
| data | The data to display as a table. This expects an array of objects. |
| title | The title for the table. |
| columns | The comma-separated list of columns to display. This accepts nested columns using dot notation. |
Outputs
There are no outputs for this script.