I am using node.js and as a side project i am creating a module that reads a .json file ,parse it then create directory structure based on object properties & object values.
Object properties(keys) would be the path to itself/to files & object values would be the list of files for that path
i have tried to recurse downwards through the object but i dont know how i extract the path from the inner-most object of each object
Also object would be dynamic as would be created by the user.
var path = 'c:/templates/<angular-app>'; var template = { //outline of 'angular-app' src:{ jade:['main.jade'], scripts:{ modules:{ render:['index.js'], winodws:['index.js'], header:['header.js' ,'controller.js'], SCSS:['index.scss' ,'setup.scss'], } } }, compiled:['angular.js','angular-material.js' ,'fallback.js'], built:{ frontEnd:[],//if the array is empty then create the path anyways backEnd:[], assets:{ fontAwesome:['font-awesome.css'], img:[], svg:[] } } } //desired result... let out = [ 'c:/template name/src/jade/main.jade', 'c:/template name/src/scripts/index.js', 'c:/template name/src/scripts/modules/render/index.js', 'c:/template name/compiled/angular.js', 'c:/template name/compiled/angular-material.js', 'c:/template name/compiled/fallback.js', 'c:/template name/built/frontEnd/', 'c:/template name/built/backEnd/', //...ect... ];