MCPcopy Create free account
hub / github.com/breck7/scroll / toDataTable

Method toDataTable

external/.scrollLibs.js:16358–16369  ·  view source on GitHub ↗
(header = this._getUnionNames())

Source from the content-addressed store, hash-verified

16356 return types
16357 }
16358 toDataTable(header = this._getUnionNames()) {
16359 const types = this._getTypes(header)
16360 const parsers = {
16361 string: str => str,
16362 float: parseFloat,
16363 int: parseInt
16364 }
16365 const atomFn = (atomValue, rowIndex, columnIndex) => (rowIndex ? parsers[types[columnIndex]](atomValue) : atomValue)
16366 const arrays = this._toArrays(header, atomFn)
16367 arrays.rows.unshift(arrays.header)
16368 return arrays.rows
16369 }
16370 toDelimited(delimiter, header = this._getUnionNames(), escapeSpecialChars = true) {
16371 const regex = new RegExp(`(\\n|\\"|\\${delimiter})`)
16372 const atomFn = (str, row, column) => (!str.toString().match(regex) ? str : `"` + str.replace(/\"/g, `""`) + `"`)

Callers

nothing calls this directly

Calls 3

_getUnionNamesMethod · 0.95
_getTypesMethod · 0.95
_toArraysMethod · 0.95

Tested by

no test coverage detected