Created
December 9, 2015 19:16
-
-
Save yusufiga/3fed0690e2aee3ca3cf4 to your computer and use it in GitHub Desktop.
Get Deployd Collections
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
var dirTree = require('directory-tree'); | |
console.log(getCollections()); | |
function getCollections (){ | |
var tree = dirTree.directoryTree('resources/',['.json']); | |
var collections = collections || []; | |
console.log(tree.children); | |
for (var i in tree.children) { | |
var obj = {}; | |
//var data = tree.children[i]. | |
var structure = require("./resources/"+tree.children[i].children[0].path); | |
obj[tree.children[i].name] = structure.properties ; | |
collections.push(obj); | |
} | |
return collections; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment