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

Method _getHeader

external/.scrollLibs.js:17825–17843  ·  view source on GitHub ↗
(rows, hasHeaders)

Source from the content-addressed store, hash-verified

17823 return result
17824 }
17825 static _getHeader(rows, hasHeaders) {
17826 const numberOfColumns = rows[0].length
17827 const headerRow = hasHeaders ? rows[0] : []
17828 const AtomBreakSymbol = " "
17829 const ziRegex = new RegExp(AtomBreakSymbol, "g")
17830 if (hasHeaders) {
17831 // Strip any AtomBreakSymbols from column names in the header row.
17832 // This makes the mapping not quite 1 to 1 if there are any AtomBreakSymbols in names.
17833 for (let index = 0; index < numberOfColumns; index++) {
17834 headerRow[index] = headerRow[index].replace(ziRegex, "")
17835 }
17836 } else {
17837 // If str has no headers, create them as 0,1,2,3
17838 for (let index = 0; index < numberOfColumns; index++) {
17839 headerRow.push(index.toString())
17840 }
17841 }
17842 return headerRow
17843 }
17844 static nest(str, xValue) {
17845 const ParticleBreakSymbol = PARTICLE_MEMBRANE
17846 const AtomBreakSymbol = ATOM_MEMBRANE

Callers 1

_rowsToParticleMethod · 0.95

Calls 2

replaceMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected