Comparing version
10
index.js
@@ -14,9 +14,10 @@ // Requires | ||
// to contain only a flat array of leaves | ||
function cleanDump(obj) { | ||
function normalize(obj) { | ||
obj = obj.node || obj; | ||
// Is a leaf | ||
if(!_.has(obj, 'kvs')) { | ||
if(!_.has(obj, 'nodes')) { | ||
// We don't want the modifiedIndex attr in our dumps/restores | ||
return _.pick(obj, 'key', 'value'); | ||
} | ||
return _.flatten(_.map(obj.kvs, cleanDump)); | ||
return _.flatten(_.map(obj.nodes, normalize)); | ||
} | ||
@@ -37,3 +38,3 @@ | ||
}) | ||
.then(cleanDump); | ||
.then(normalize); | ||
}; | ||
@@ -57,1 +58,2 @@ | ||
module.exports = createDumper; | ||
module.exports.normalize = normalize; |
{ | ||
"name": "etcd-dump", | ||
"version": "0.0.6", | ||
"version": "0.1.0", | ||
"description": "A tool for dumping and restoring etcd", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
15187
0.5%81
2.53%