svg-table 0.0.2 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +9 -0
- package/README.md +447 -1
- package/TableFormatter.ts +286 -5
- package/TableStyler.ts +74 -5
- package/dist/TableFormatter.d.ts +280 -0
- package/dist/TableFormatter.d.ts.map +1 -1
- package/dist/TableFormatter.js +286 -5
- package/dist/TableFormatter.js.map +1 -1
- package/dist/TableStyler.d.ts +56 -1
- package/dist/TableStyler.d.ts.map +1 -1
- package/dist/TableStyler.js +61 -2
- package/dist/TableStyler.js.map +1 -1
- package/dist/tableFormatter.test.js +41 -2
- package/dist/tableFormatter.test.js.map +1 -1
- package/dist/tableStyler.test.js +222 -6
- package/dist/tableStyler.test.js.map +1 -1
- package/dist/tableSvg.js +4 -2
- package/dist/tableSvg.js.map +1 -1
- package/package.json +1 -1
- package/tableFormatter.test.ts +46 -2
- package/tableStyler.test.ts +130 -7
- package/tableSvg.ts +4 -2
package/dist/TableFormatter.d.ts
CHANGED
|
@@ -60,6 +60,9 @@ export declare class TableFormatter<V> {
|
|
|
60
60
|
* @param formatter The formatter
|
|
61
61
|
* @param [priority = 0] The priority of this formatter. If cells have more than one associated formatter,
|
|
62
62
|
* the one with the highest priority number is used.
|
|
63
|
+
* @see addColumnFormatters
|
|
64
|
+
* @see addRowFormatter
|
|
65
|
+
* @see addRowFormatters
|
|
63
66
|
* @example
|
|
64
67
|
* ```typescript
|
|
65
68
|
* // create the data
|
|
@@ -98,12 +101,279 @@ export declare class TableFormatter<V> {
|
|
|
98
101
|
* ```
|
|
99
102
|
*/
|
|
100
103
|
addColumnFormatter(columnIndex: number, formatter: Formatter<V>, priority?: number): Result<TableFormatter<V>, string>;
|
|
104
|
+
/**
|
|
105
|
+
* Adds formatters to specified column indexes in a table formatter.
|
|
106
|
+
*
|
|
107
|
+
* @param columnIndexes An array of column indexes to which the formatter will be applied.
|
|
108
|
+
* @param formatter The formatting function to apply to the specified columns.
|
|
109
|
+
* @param [priority = 0] The priority level for the formatter. Higher priority formatters are applied first.
|
|
110
|
+
* @return A result indicating the success or failure of adding the column formatters.
|
|
111
|
+
* @see addColumnFormatter
|
|
112
|
+
* @see addRowFormatter
|
|
113
|
+
* @see addRowFormatters
|
|
114
|
+
* @see addCellFormatter
|
|
115
|
+
* @see addCellFormatters
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const data = DataFrame.from<string | number | Date>([
|
|
120
|
+
* [dateTimeFor(1, 1), 12345, 'gnm-f234', 123.45, 4],
|
|
121
|
+
* [dateTimeFor(2, 2), 23456, 'gnm-g234', 23.45, 5],
|
|
122
|
+
* [dateTimeFor(3, 3), 34567, 'gnm-h234', 3.65, 40],
|
|
123
|
+
* [dateTimeFor(4, 4), 45678, 'gnm-i234', 314.15, 9],
|
|
124
|
+
* ]).getOrThrow()
|
|
125
|
+
* const columnHeader = ['Date-Time', 'Customer ID', 'Product ID', 'Purchase Price', 'Amount']
|
|
126
|
+
* const rowHeader = [1, 2, 3, 4]
|
|
127
|
+
*
|
|
128
|
+
* const tableData = TableData.fromDataFrame<string | number | Date>(data)
|
|
129
|
+
* .withColumnHeader(columnHeader)
|
|
130
|
+
* .flatMap(td => td.withRowHeader(rowHeader))
|
|
131
|
+
* .flatMap(tableData => TableFormatter.fromTableData(tableData)
|
|
132
|
+
* // add the default formatter for the column header, at the highest priority so that
|
|
133
|
+
* // it is the one that applies to the row representing the column header
|
|
134
|
+
* .addRowFormatters([0], defaultFormatter, Infinity)
|
|
135
|
+
* // add the default formatter for the row header, at the highest priority so that
|
|
136
|
+
* // it is the one that applies to the column representing the row header
|
|
137
|
+
* .flatMap(tf => tf.addColumnFormatters([0], defaultFormatter, Infinity))
|
|
138
|
+
* // add the column formatters for each column at the default (lowest) priority
|
|
139
|
+
* // (notice that the columns are shifted by one for the columns because the row-header
|
|
140
|
+
* // occupies the first column (index=0))
|
|
141
|
+
* .flatMap(tf => tf.addColumnFormatter(1, value => (value as Date).toLocaleDateString()))
|
|
142
|
+
* .flatMap(tf => tf.addColumnFormatter(2, value => defaultFormatter(value)))
|
|
143
|
+
* .flatMap(tf => tf.addColumnFormatter(4, value => `$ ${(value as number).toFixed(2)}`))
|
|
144
|
+
* .flatMap(tf => tf.addColumnFormatter(5, value => `${(value as number).toFixed(0)}`))
|
|
145
|
+
* // format the table data and get back a TableData<string>
|
|
146
|
+
* .flatMap(tf => tf.formatTable())
|
|
147
|
+
* )
|
|
148
|
+
* .getOrThrow()
|
|
149
|
+
*
|
|
150
|
+
* const expectedData = DataFrame.from<string>([
|
|
151
|
+
* ['2/1/2021', '12345', 'gnm-f234', '$ 123.45', '4'],
|
|
152
|
+
* ['2/2/2021', '23456', 'gnm-g234', '$ 23.45', '5'],
|
|
153
|
+
* ['2/3/2021', '34567', 'gnm-h234', '$ 3.65', '40'],
|
|
154
|
+
* ['2/4/2021', '45678', 'gnm-i234', '$ 314.15', '9'],
|
|
155
|
+
* ]).getOrThrow()
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
101
158
|
addColumnFormatters(columnIndexes: Array<number>, formatter: Formatter<V>, priority?: number): Result<TableFormatter<V>, string>;
|
|
102
159
|
private static addColumnFormatters;
|
|
160
|
+
/**
|
|
161
|
+
* Formatters convert the row value types to formatted strings. The formatter used to format each cell in
|
|
162
|
+
* a given row depends on the priority of each formatter associated with that cell. The formatter with the
|
|
163
|
+
* highest priority is used. If two or more formatters for a given cell have the same priority, the selected
|
|
164
|
+
* formatter is indeterminant.
|
|
165
|
+
* @param rowIndex The index of the row to which to add the formatter
|
|
166
|
+
* @param formatter The formatter
|
|
167
|
+
* @param [priority = 0] The priority of this formatter. If cells have more than one associated formatter,
|
|
168
|
+
* the one with the highest priority number is used.
|
|
169
|
+
* @see addColumnFormatter
|
|
170
|
+
* @see addColumnFormatters
|
|
171
|
+
* @see addRowFormatters
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* // create the data
|
|
175
|
+
* const data = DataFrame.from<string | number | Date>([
|
|
176
|
+
* [dateTimeFor(1, 1), 12345, 'gnm-f234', 123.45, 4],
|
|
177
|
+
* [dateTimeFor(2, 2), 23456, 'gnm-g234', 23.45, 5],
|
|
178
|
+
* [dateTimeFor(3, 3), 34567, 'gnm-h234', 3.65, 40],
|
|
179
|
+
* [dateTimeFor(4, 4), 45678, 'gnm-i234', 314.15, 9],
|
|
180
|
+
* ]).getOrThrow()
|
|
181
|
+
*
|
|
182
|
+
* // create the table-data object from the data, and then hand the table-data
|
|
183
|
+
* // to the table formatter, add column formats, and format the table, getting
|
|
184
|
+
* // back a new TableData<string>
|
|
185
|
+
* const tableData: TableData<string> = TableData.fromDataFrame<string | number | Date>(data)
|
|
186
|
+
* // from the table-data, create a table-formatter
|
|
187
|
+
* .flatMap(tableData => createTableFormatterFrom(tableData)
|
|
188
|
+
* // add a column formatter for the first column of dates
|
|
189
|
+
* .addColumnFormatter(0, value => (value as Date).toLocaleDateString())
|
|
190
|
+
* // add a column formatter to the second column of number
|
|
191
|
+
* .flatMap(tf => tf.addColumnFormatter(1, value => defaultFormatter(value)))
|
|
192
|
+
* // add a column formatter to the fourth column of currencies
|
|
193
|
+
* .flatMap(tf => tf.addColumnFormatter(3, value => `$ ${(value as number).toFixed(2)}`))
|
|
194
|
+
* .flatMap(tf => tf.addColumnFormatter(4, value => `${(value as number).toFixed(0)}`))
|
|
195
|
+
* // format the table into a new TableData<string> object
|
|
196
|
+
* .flatMap(tf => tf.formatTable())
|
|
197
|
+
* )
|
|
198
|
+
* .getOrThrow()
|
|
199
|
+
*
|
|
200
|
+
* // we expect the data-frame in the table data to be the following
|
|
201
|
+
* const expectedData = DataFrame.from<string>([
|
|
202
|
+
* ['2/1/2021', '12345', 'gnm-f234', '$ 123.45', '4'],
|
|
203
|
+
* ['2/2/2021', '23456', 'gnm-g234', '$ 23.45', '5'],
|
|
204
|
+
* ['2/3/2021', '34567', 'GNM-H234', '$ 3.65', '40'],
|
|
205
|
+
* ['2/4/2021', '45678', 'gnm-i234', '$ 314.15', '9'],
|
|
206
|
+
* ]).getOrThrow()
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
103
209
|
addRowFormatter(rowIndex: number, formatter: Formatter<V>, priority?: number): Result<TableFormatter<V>, string>;
|
|
210
|
+
/**
|
|
211
|
+
* Adds formatters to specified row indexes in a table formatter.
|
|
212
|
+
*
|
|
213
|
+
* @param rowIndexes An array of row indexes to which the formatter will be applied.
|
|
214
|
+
* @param formatter The formatting function to apply to the specified columns.
|
|
215
|
+
* @param [priority = 0] The priority level for the formatter. Higher priority formatters are applied first.
|
|
216
|
+
* @return A result indicating the success or failure of adding the row formatters.
|
|
217
|
+
* @see addColumnFormatter
|
|
218
|
+
* @see addRowFormatter
|
|
219
|
+
* @see addRowFormatters
|
|
220
|
+
* @see addCellFormatter
|
|
221
|
+
* @see addCellFormatters
|
|
222
|
+
* @example
|
|
223
|
+
* ```typescript
|
|
224
|
+
* const data = DataFrame.from<string | number | Date>([
|
|
225
|
+
* [dateTimeFor(1, 1), 12345, 'gnm-f234', 123.45, 4],
|
|
226
|
+
* [dateTimeFor(2, 2), 23456, 'gnm-g234', 23.45, 5],
|
|
227
|
+
* [dateTimeFor(3, 3), 34567, 'gnm-h234', 3.65, 40],
|
|
228
|
+
* [dateTimeFor(4, 4), 45678, 'gnm-i234', 314.15, 9],
|
|
229
|
+
* ]).getOrThrow()
|
|
230
|
+
* const columnHeader = ['Date-Time', 'Customer ID', 'Product ID', 'Purchase Price', 'Amount']
|
|
231
|
+
* const rowHeader = [1, 2, 3, 4]
|
|
232
|
+
*
|
|
233
|
+
* const tableData = TableData.fromDataFrame<string | number | Date>(data)
|
|
234
|
+
* .withColumnHeader(columnHeader)
|
|
235
|
+
* .flatMap(td => td.withRowHeader(rowHeader))
|
|
236
|
+
* .flatMap(tableData => TableFormatter.fromTableData(tableData)
|
|
237
|
+
* // add the default formatter for the column header, at the highest priority so that
|
|
238
|
+
* // it is the one that applies to the row representing the column header
|
|
239
|
+
* .addRowFormatters([0], defaultFormatter, Infinity)
|
|
240
|
+
* // add the default formatter for the row header, at the highest priority so that
|
|
241
|
+
* // it is the one that applies to the column representing the row header
|
|
242
|
+
* .flatMap(tf => tf.addColumnFormatters([0], defaultFormatter, Infinity))
|
|
243
|
+
* // add the column formatters for each column at the default (lowest) priority
|
|
244
|
+
* // (notice that the columns are shifted by one for the columns because the row-header
|
|
245
|
+
* // occupies the first column (index=0))
|
|
246
|
+
* .flatMap(tf => tf.addColumnFormatter(1, value => (value as Date).toLocaleDateString()))
|
|
247
|
+
* .flatMap(tf => tf.addColumnFormatter(2, value => defaultFormatter(value)))
|
|
248
|
+
* .flatMap(tf => tf.addColumnFormatter(4, value => `$ ${(value as number).toFixed(2)}`))
|
|
249
|
+
* .flatMap(tf => tf.addColumnFormatter(5, value => `${(value as number).toFixed(0)}`))
|
|
250
|
+
* // format the table data and get back a TableData<string>
|
|
251
|
+
* .flatMap(tf => tf.formatTable())
|
|
252
|
+
* )
|
|
253
|
+
* .getOrThrow()
|
|
254
|
+
*
|
|
255
|
+
* const expectedData = DataFrame.from<string>([
|
|
256
|
+
* ['2/1/2021', '12345', 'gnm-f234', '$ 123.45', '4'],
|
|
257
|
+
* ['2/2/2021', '23456', 'gnm-g234', '$ 23.45', '5'],
|
|
258
|
+
* ['2/3/2021', '34567', 'gnm-h234', '$ 3.65', '40'],
|
|
259
|
+
* ['2/4/2021', '45678', 'gnm-i234', '$ 314.15', '9'],
|
|
260
|
+
* ]).getOrThrow()
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
104
263
|
addRowFormatters(rowIndexes: Array<number>, formatter: Formatter<V>, priority?: number): Result<TableFormatter<V>, string>;
|
|
105
264
|
private static addRowFormatters;
|
|
265
|
+
/**
|
|
266
|
+
* Adds a formatter to a specified cell based on the row and column indexes.
|
|
267
|
+
* @param rowIndex The row index of the cell.
|
|
268
|
+
* @param columnIndex The column index of the cell.
|
|
269
|
+
* @param formatter The formatter to apply to the cell.
|
|
270
|
+
* @param [priority = 0] The priority level for the formatter. Higher priority formatters are applied first.
|
|
271
|
+
* @return A result indicating the success or failure of adding the cell formatter.
|
|
272
|
+
* @see addColumnFormatter
|
|
273
|
+
* @see addRowFormatter
|
|
274
|
+
* @see addRowFormatters
|
|
275
|
+
* @see addCellFormatters
|
|
276
|
+
* @see addCellFormatters
|
|
277
|
+
* @example
|
|
278
|
+
* ```typescript
|
|
279
|
+
* const data = DataFrame.from<string | number | Date>([
|
|
280
|
+
* [dateTimeFor(1, 1), 12345, 'gnm-f234', 123.45, 4],
|
|
281
|
+
* [dateTimeFor(2, 2), 23456, 'gnm-g234', 23.45, 5],
|
|
282
|
+
* [dateTimeFor(3, 3), 34567, 'gnm-h234', 3.65, 40],
|
|
283
|
+
* [dateTimeFor(4, 4), 45678, 'gnm-i234', 314.15, 9],
|
|
284
|
+
* ]).getOrThrow()
|
|
285
|
+
* const columnHeader = ['Date-Time', 'Customer ID', 'Product ID', 'Purchase Price', 'Amount']
|
|
286
|
+
* const rowHeader = [1, 2, 3, 4]
|
|
287
|
+
*
|
|
288
|
+
* const tableData = TableData.fromDataFrame<string | number | Date>(data)
|
|
289
|
+
* .withColumnHeader(columnHeader)
|
|
290
|
+
* .flatMap(td => td.withRowHeader(rowHeader))
|
|
291
|
+
* .flatMap(tableData => TableFormatter.fromTableData(tableData)
|
|
292
|
+
* // add the default formatter for the column header, at the highest priority so that
|
|
293
|
+
* // it is the one that applies to the row representing the column header
|
|
294
|
+
* .addRowFormatters([0], defaultFormatter, Infinity)
|
|
295
|
+
* // add the default formatter for the row header, at the highest priority so that
|
|
296
|
+
* // it is the one that applies to the column representing the row header
|
|
297
|
+
* .flatMap(tf => tf.addColumnFormatters([0], defaultFormatter, Infinity))
|
|
298
|
+
* // add the column formatters for each column at the default (lowest) priority
|
|
299
|
+
* // (notice that the columns are shifted by one for the columns because the row-header
|
|
300
|
+
* // occupies the first column (index=0))
|
|
301
|
+
* .flatMap(tf => tf.addColumnFormatter(1, value => (value as Date).toLocaleDateString()))
|
|
302
|
+
* .flatMap(tf => tf.addColumnFormatter(2, value => defaultFormatter(value)))
|
|
303
|
+
* .flatMap(tf => tf.addColumnFormatter(4, value => `$ ${(value as number).toFixed(2)}`))
|
|
304
|
+
* .flatMap(tf => tf.addColumnFormatter(5, value => `${(value as number).toFixed(0)}`))
|
|
305
|
+
* // override the cell formatter for a select set of cells
|
|
306
|
+
* .flatMap(tf => tf.addCellFormatter(1, 4, value => `${(value as number).toFixed(2)}`, 1000))
|
|
307
|
+
* .flatMap(tf => tf.addCellFormatters([[3, 5], [4, 5]], value => `${((value as number) * 10).toFixed(0)}`, 1000))
|
|
308
|
+
* // format the table data and get back a TableData<string>
|
|
309
|
+
* .flatMap(tf => tf.formatTable())
|
|
310
|
+
* )
|
|
311
|
+
* .getOrThrow()
|
|
312
|
+
*
|
|
313
|
+
* const expectedData = DataFrame.from<string>([
|
|
314
|
+
* ['2/1/2021', '12345', 'gnm-f234', '123.45', '4'], // overwrite (1, 4) to remove "$"
|
|
315
|
+
* ['2/2/2021', '23456', 'gnm-g234', '$ 23.45', '5'],
|
|
316
|
+
* ['2/3/2021', '34567', 'gnm-h234', '$ 3.65', '400'], // overwrite (3, 5) to multiply by 10
|
|
317
|
+
* ['2/4/2021', '45678', 'gnm-i234', '$ 314.15', '90'], // overwrite (4, 5) to multiply by 10
|
|
318
|
+
* ]).getOrThrow()
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
106
321
|
addCellFormatter(rowIndex: number, columnIndex: number, formatter: Formatter<V>, priority?: number): Result<TableFormatter<V>, string>;
|
|
322
|
+
/**
|
|
323
|
+
* Adds formatters to specified cell indexes in a table formatter.
|
|
324
|
+
* @param cellIndexes An array of cell indexes to which the formatter will be applied.
|
|
325
|
+
* @param formatter The formatting function to apply to the specified cells.
|
|
326
|
+
* @param [priority = 0] The priority level for the formatter. Higher priority formatters are applied first.
|
|
327
|
+
* @return A result indicating the success or failure of adding the cell formatters.
|
|
328
|
+
* @see addColumnFormatter
|
|
329
|
+
* @see addRowFormatter
|
|
330
|
+
* @see addRowFormatters
|
|
331
|
+
* @see addCellFormatters
|
|
332
|
+
* @see addCellFormatters
|
|
333
|
+
* @example
|
|
334
|
+
* ```typescript
|
|
335
|
+
* const data = DataFrame.from<string | number | Date>([
|
|
336
|
+
* [dateTimeFor(1, 1), 12345, 'gnm-f234', 123.45, 4],
|
|
337
|
+
* [dateTimeFor(2, 2), 23456, 'gnm-g234', 23.45, 5],
|
|
338
|
+
* [dateTimeFor(3, 3), 34567, 'gnm-h234', 3.65, 40],
|
|
339
|
+
* [dateTimeFor(4, 4), 45678, 'gnm-i234', 314.15, 9],
|
|
340
|
+
* ]).getOrThrow()
|
|
341
|
+
* const columnHeader = ['Date-Time', 'Customer ID', 'Product ID', 'Purchase Price', 'Amount']
|
|
342
|
+
* const rowHeader = [1, 2, 3, 4]
|
|
343
|
+
*
|
|
344
|
+
* const tableData = TableData.fromDataFrame<string | number | Date>(data)
|
|
345
|
+
* .withColumnHeader(columnHeader)
|
|
346
|
+
* .flatMap(td => td.withRowHeader(rowHeader))
|
|
347
|
+
* .flatMap(tableData => TableFormatter.fromTableData(tableData)
|
|
348
|
+
* // add the default formatter for the column header, at the highest priority so that
|
|
349
|
+
* // it is the one that applies to the row representing the column header
|
|
350
|
+
* .addRowFormatters([0], defaultFormatter, Infinity)
|
|
351
|
+
* // add the default formatter for the row header, at the highest priority so that
|
|
352
|
+
* // it is the one that applies to the column representing the row header
|
|
353
|
+
* .flatMap(tf => tf.addColumnFormatters([0], defaultFormatter, Infinity))
|
|
354
|
+
* // add the column formatters for each column at the default (lowest) priority
|
|
355
|
+
* // (notice that the columns are shifted by one for the columns because the row-header
|
|
356
|
+
* // occupies the first column (index=0))
|
|
357
|
+
* .flatMap(tf => tf.addColumnFormatter(1, value => (value as Date).toLocaleDateString()))
|
|
358
|
+
* .flatMap(tf => tf.addColumnFormatter(2, value => defaultFormatter(value)))
|
|
359
|
+
* .flatMap(tf => tf.addColumnFormatter(4, value => `$ ${(value as number).toFixed(2)}`))
|
|
360
|
+
* .flatMap(tf => tf.addColumnFormatter(5, value => `${(value as number).toFixed(0)}`))
|
|
361
|
+
* // override the cell formatter for a select set of cells
|
|
362
|
+
* .flatMap(tf => tf.addCellFormatter(1, 4, value => `${(value as number).toFixed(2)}`, 1000))
|
|
363
|
+
* .flatMap(tf => tf.addCellFormatters([[3, 5], [4, 5]], value => `${((value as number) * 10).toFixed(0)}`, 1000))
|
|
364
|
+
* // format the table data and get back a TableData<string>
|
|
365
|
+
* .flatMap(tf => tf.formatTable())
|
|
366
|
+
* )
|
|
367
|
+
* .getOrThrow()
|
|
368
|
+
*
|
|
369
|
+
* const expectedData = DataFrame.from<string>([
|
|
370
|
+
* ['2/1/2021', '12345', 'gnm-f234', '123.45', '4'], // overwrite (1, 4) to remove "$"
|
|
371
|
+
* ['2/2/2021', '23456', 'gnm-g234', '$ 23.45', '5'],
|
|
372
|
+
* ['2/3/2021', '34567', 'gnm-h234', '$ 3.65', '400'], // overwrite (3, 5) to multiply by 10
|
|
373
|
+
* ['2/4/2021', '45678', 'gnm-i234', '$ 314.15', '90'], // overwrite (4, 5) to multiply by 10
|
|
374
|
+
* ]).getOrThrow()
|
|
375
|
+
* ```
|
|
376
|
+
*/
|
|
107
377
|
addCellFormatters(cellIndexes: Array<[x: number, y: number]>, formatter: Formatter<V>, priority?: number): Result<TableFormatter<V>, string>;
|
|
108
378
|
private static addCellFormatters;
|
|
109
379
|
/**
|
|
@@ -174,6 +444,16 @@ export declare class TableFormatter<V> {
|
|
|
174
444
|
* ```
|
|
175
445
|
*/
|
|
176
446
|
formatTable<C extends TagCoordinate>(): Result<TableData<string>, string>;
|
|
447
|
+
/**
|
|
448
|
+
* Generally, the {@link TableFormatter} formats the {@link DataFrame} into a `TableData<string>`
|
|
449
|
+
* where all the elements of the {@link TableData} are a string. Because a formatted table does
|
|
450
|
+
* not necessarily have to be a `TableData<string>` (which would contain a `DataFrame<string>`,
|
|
451
|
+
* this method allows mapping a {@link DataFrame} into any desired type.
|
|
452
|
+
* @param mapper A function that takes a `DataFrame<string>` and returns a desired type (`D`).
|
|
453
|
+
* @return A `Result<D, string>` where the `Result<D, string>` is either success, containing the
|
|
454
|
+
* desired type (`D`), or failure, containing an error message.
|
|
455
|
+
* @see formatTable
|
|
456
|
+
*/
|
|
177
457
|
formatTableInto<C extends TagCoordinate, D = TableData<string>>(mapper: (dataFrame: DataFrame<string>) => D): Result<D, string>;
|
|
178
458
|
}
|
|
179
459
|
//# sourceMappingURL=TableFormatter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableFormatter.d.ts","sourceRoot":"","sources":["../TableFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,KAAK,GAAG,EAAE,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAC,MAAM,eAAe,CAAC;AACrF,OAAO,EAAgB,KAAK,MAAM,EAAgB,MAAM,WAAW,CAAC;AACpE,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAA;AAE/C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAEpD;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IACxB,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;IACvB,QAAQ,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,iBAAiB,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAKpD;AAED,oBAAY,kBAAkB;IAC1B,IAAI,mBAAmB;IACvB,MAAM,qBAAqB;IAC3B,GAAG,kBAAkB;CACxB;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE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