Skip to content

Instantly share code, notes, and snippets.

@DigiTec
Last active August 29, 2015 14:26
Show Gist options
  • Save DigiTec/3ad1f1fea392f6227437 to your computer and use it in GitHub Desktop.
Save DigiTec/3ad1f1fea392f6227437 to your computer and use it in GitHub Desktop.
3 Days of Data Science Blog Entry Snippets
[
{ "iface" : "HTMLElement", "member": "className", "owner": "Jim" },
{ "iface" : "SVGElement", "member": "className", "owner": "Joe" },
{ "iface" : "SVGElement", "member": "style", "owner": "Jim" },
]
{
"HTMLElement" : {
"className": {
"owner" : "Jim"
}
},
"SVGElement" : {
"className": {
"owner" : "Joe"
},
"style": {
"owner" : "Jim"
}
}
}
var myData = require('./Flat_Data.json');
var filtered = myData.filter(function (row) {
// Hard-coding, but this could easily be keyed and this filter function could be generic
return (row.owner === "Jim");
}).reduce(function (prev, curr) {
// Hard-coding again, but this could by keyed yet again
if (!prev.hasOwnProperty(curr.iface)) {
prev[curr.iface] = [];
}
prev[curr.iface].push(curr);
return prev;
}, {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment