This file contains 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
module.exports = function sortCategoriesForInsert (inputJson) { | |
let dataTree = function (inputJson, root) { | |
var r = [], o = {}; | |
inputJson.forEach(function (a) { | |
o[a.id] = { data: a, children: o[a.id] && o[a.id].children }; | |
if (a.parent_id === root) { | |
r.push(o[a.id]); | |
} else { | |
o[a.parent_id] = o[a.parent_id] || {}; |
This file contains 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
{ | |
"meta": { | |
"theme": "stackoverflow" | |
}, | |
"basics": { | |
"name": "Varun Rayen", | |
"label": "Full Stack/DevOps Engineer", | |
"picture": "", | |
"email": "hello@varunrayen.me", | |
"phone": "(+91)-9994043105", |