Skip to content

Instantly share code, notes, and snippets.

@vadviktor
Forked from mca-gif/JSON.js
Created July 25, 2017 17:12
Show Gist options
  • Save vadviktor/d408321e45cb6e9718d11c084339bdb3 to your computer and use it in GitHub Desktop.
Save vadviktor/d408321e45cb6e9718d11c084339bdb3 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