Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Reduces treeize data
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
You can’t perform that action at this time.