Last active
August 29, 2015 14:26
-
-
Save DigiTec/3ad1f1fea392f6227437 to your computer and use it in GitHub Desktop.
3 Days of Data Science Blog Entry Snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ "iface" : "HTMLElement", "member": "className", "owner": "Jim" }, | |
{ "iface" : "SVGElement", "member": "className", "owner": "Joe" }, | |
{ "iface" : "SVGElement", "member": "style", "owner": "Jim" }, | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"HTMLElement" : { | |
"className": { | |
"owner" : "Jim" | |
} | |
}, | |
"SVGElement" : { | |
"className": { | |
"owner" : "Joe" | |
}, | |
"style": { | |
"owner" : "Jim" | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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