Skip to content

Instantly share code, notes, and snippets.

@mca-gif
Created July 26, 2016 17:43
Show Gist options
  • Save mca-gif/a331ddcaf5314da853761b8feb6ac689 to your computer and use it in GitHub Desktop.
Save mca-gif/a331ddcaf5314da853761b8feb6ac689 to your computer and use it in GitHub Desktop.
JSON Data Extractor for the IntelliJ IDEA Platform
function eachWithIdx(iterable, f) { var i = iterable.iterator(); var idx = 0; while (i.hasNext()) f(i.next(), idx++); }
function mapEach(iterable, f) { var vs = []; eachWithIdx(iterable, function (i) { vs.push(f(i));}); return vs; }
OUT.append(JSON.stringify( mapEach(ROWS, function(row, row_idx) {
var r = {};
eachWithIdx(COLUMNS, function(col, col_idx) { r[ col.name() ] = row.value(col); });
return r;
})));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment