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

Method _getTypes

external/.scrollLibs.js:16340–16357  ·  view source on GitHub ↗
(header)

Source from the content-addressed store, hash-verified

16338 return this.toDelimited(",")
16339 }
16340 _getTypes(header) {
16341 const matrix = this._getMatrix(header)
16342 const types = header.map(i => "int")
16343 matrix.forEach(row => {
16344 row.forEach((value, index) => {
16345 const type = types[index]
16346 if (type === "string") return 1
16347 if (value === undefined || value === "") return 1
16348 if (type === "float") {
16349 if (value.match(/^\-?[0-9]*\.?[0-9]*$/)) return 1
16350 types[index] = "string"
16351 }
16352 if (value.match(/^\-?[0-9]+$/)) return 1
16353 types[index] = "string"
16354 })
16355 })
16356 return types
16357 }
16358 toDataTable(header = this._getUnionNames()) {
16359 const types = this._getTypes(header)
16360 const parsers = {

Callers 1

toDataTableMethod · 0.95

Calls 3

_getMatrixMethod · 0.95
mapMethod · 0.80
forEachMethod · 0.80

Tested by

no test coverage detected