Socket
Socket
Sign inDemoInstall

flat

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flat - npm Package Compare versions

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 @@ })

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc