Comparing version 2.0.0 to 2.0.1
14
index.js
@@ -12,6 +12,6 @@ var isBuffer = require('is-buffer') | ||
var maxDepth = opts.maxDepth | ||
var currentDepth = 1 | ||
var output = {} | ||
function step(object, prev) { | ||
function step(object, prev, currentDepth) { | ||
currentDepth = currentDepth ? currentDepth : 1 | ||
Object.keys(object).forEach(function(key) { | ||
@@ -31,11 +31,7 @@ var value = object[key] | ||
if (!opts.maxDepth) { | ||
maxDepth = currentDepth + 1; | ||
if (!isarray && !isbuffer && isobject && Object.keys(value).length && | ||
(!opts.maxDepth || currentDepth < maxDepth)) { | ||
return step(value, newKey, currentDepth + 1) | ||
} | ||
if (!isarray && !isbuffer && isobject && Object.keys(value).length && currentDepth < maxDepth) { | ||
++currentDepth | ||
return step(value, newKey) | ||
} | ||
output[newKey] = value | ||
@@ -42,0 +38,0 @@ }) |
{ | ||
"name": "flat", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -148,2 +148,7 @@ var assert = require('assert') | ||
} | ||
}, | ||
lorem: { | ||
ipsum: { | ||
dolor: 'good evening' | ||
} | ||
} | ||
@@ -155,2 +160,5 @@ }, { | ||
again: 'good morning' | ||
}, | ||
'lorem.ipsum': { | ||
dolor: 'good evening' | ||
} | ||
@@ -157,0 +165,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
18228
510