Created
October 30, 2017 05:33
-
-
Save JeffML/1bbe228f271765d3ee3a917196e8a81c to your computer and use it in GitHub Desktop.
Reduces treeize data
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
if (useMethod === 'treeizedReduced') { | |
var rs = treeized(resultSet) | |
const rsr = rs.reduce((o, r) => { | |
const rc = r.categories.reduce((oo, c) => { | |
oo[c.type] = { | |
titles: c.titles.map(t => t.name) | |
} | |
return oo; | |
}, {}) | |
o[r.name] = { | |
categories: rc | |
}; | |
return o; | |
}, {}); | |
console.log(JSON.stringify({ | |
treeizedReduced: rsr | |
}, null, 4)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment