Created
October 30, 2017 00:19
-
-
Save JeffML/d79ab5928dd9636f0d9d51ef5842061a to your computer and use it in GitHub Desktop.
Using treeize to generate JSON heirarchies
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
import Treeize from 'treeize' | |
const treeized = rs => { | |
var authors = new Treeize(); | |
const seed = rs.map(r => ({ | |
name: [r.last_name, r.first_name].join(', '), | |
'categories:type': r.category, | |
'categories:titles:name': r.title | |
})) | |
authors.grow(seed); | |
return authors.getData(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment