json-to-fs-structure
Advanced tools
Comparing version 1.2.3 to 1.2.4
13
index.js
@@ -40,2 +40,3 @@ const fs = require("fs"); | ||
const newPath = spaceReplace ? `${filePath}${sep}${property.replace(/ /g, spaceReplace)}` : `${filePath}${sep}${property}`; | ||
let accumulatorCopy = Object.assign({}, accumulator) | ||
try { | ||
@@ -46,6 +47,6 @@ fs.mkdirSync(newPath); | ||
if (nonLeafProcedure) { | ||
nonLeafProcedure(newPath, accumulator, obj[`${property}`], property); | ||
accumulatorCopy = nonLeafProcedure(newPath, accumulator, obj[`${property}`], property); | ||
} | ||
if (procedure) { | ||
procedure(newPath, accumulator, obj[`${property}`], property); | ||
accumulatorCopy = procedure(newPath, accumulator, obj[`${property}`], property); | ||
} | ||
@@ -57,3 +58,3 @@ promiseArray = promiseArray.concat( | ||
procedure, | ||
accumulator | ||
accumulator: accumulatorCopy | ||
}) | ||
@@ -63,6 +64,6 @@ ); | ||
if (leafProcedure && isLeaf(obj[`${property}`])) { | ||
leafProcedure(newPath, accumulator, obj[`${property}`], property); | ||
leafProcedure(newPath, Object.assign({}, accumulator), obj[`${property}`], property); | ||
} | ||
if (procedure && isLeaf(obj[`${property}`])) { | ||
procedure(newPath, accumulator, obj[`${property}`], property); | ||
procedure(newPath, Object.assign({}, accumulator), obj[`${property}`], property); | ||
} | ||
@@ -72,3 +73,3 @@ } | ||
if (leafProcedure) { | ||
leafProcedure(`${filePath}${sep}`, accumulator, obj[`${property}`], property); | ||
leafProcedure(`${filePath}${sep}`, Object.assign({}, accumulator), obj[`${property}`], property); | ||
} | ||
@@ -75,0 +76,0 @@ } |
{ | ||
"name": "json-to-fs-structure", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "A simple module that takes a simple JSON file and produces the properties as a file structure in the same directory or given directory.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
191581
652