Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: more typos

...

Code Block
TSVtoArrayOfMap = function(content){          // "A\tB\n1\t2\n3\t4\n"
  lineToMap = function(line){                 // ["3\t4"]
    data = line.split(9.chr())                // ["3","4"]
    [keys,data]                               // [["A","B"],["3","4"]]
      .pairwise(function(k,d){{}.put(k,d)})   // [{"A":"3"},{"B":"4"}]
      .collect(function(m){m.keys().head()})  // {"A":["3"],"B":["4"]}
      .map(function(v){v.head()})             // {"A":"3","B","4"}
  }
  lines = content.split(lineBreakRE)          // ["A\tB","1\t2","3\t4"]
  keys = lines.head().split(9.chr()).          // ["A","B"]
  lines
    .tail()                                   // ["1\t2","3\t4"]
    .map(lineToMap)                           // [{"A":"1","B":"2"},{"A":"3","B","4"}]
}

...