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

Method objectToEncodedString

external/.tableSearch.js:39–48  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

37 return str.split(search).join(replace)
38 }
39 objectToEncodedString(obj) {
40 return Object.keys(obj)
41 .map(identifierCell => {
42 const value = obj[identifierCell]
43 const valueCells = value instanceof Array ? value : [value]
44 const row = [identifierCell, ...valueCells].map(cell => this.encodeCell(cell))
45 return row.join(this.grammar.columnDelimiter)
46 })
47 .join(this.grammar.rowDelimiter)
48 }
49 arrayToEncodedString(arr) {
50 return arr.map(line => line.map(cell => this.encodeCell(cell)).join(this.grammar.columnDelimiter)).join(this.grammar.rowDelimiter)
51 }

Callers 1

constructorMethod · 0.95

Calls 3

encodeCellMethod · 0.95
mapMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected