0.2.1 • Published 11 years ago
json-defiler v0.2.1
Json Defiler
Recursively merge files in a directory into a single json object. Useful for breaking out config files into separate folders.
Installation
$ npm install json-defiler --saveUsage
var defiler = require('json-defiler');
var json = defiler('/path/to/dir').json;Files named index.* do not generate new keys in the json object.
Example
Folder structure:
root/
+-- foo/
+-- bar/
+-- index.json
+-- baz/
+-- a.json
+-- b.json
+-- qux/
+-- index.jsDefiler output:
{
"json": {
"foo": {
"bar": { /* index.json */ },
"baz": {
"a": { /* a.json */},
"b": { /* b.json */ }
},
"qux": { /* index.js */ }
}
}
}Options
split - If set to true, files will be separated by their extension.
Otherwise, all files will be merged into the returned json property.
