Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cdxoo/flat

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cdxoo/flat - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

2

package.json
{
"name": "@cdxoo/flat",
"version": "0.0.9",
"version": "0.0.10",
"description": "does not flatten cats",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -8,2 +8,4 @@ 'use strict';

maxDepth = 0,
traverseArrays = false,
initializeArrays = false,
} = options;

@@ -15,2 +17,3 @@

var { isLeaf, path, value, parentNode } = context;
var key = path.join(delimiter);
if (maxDepth) {

@@ -21,8 +24,11 @@ if (path.length <= maxDepth) {

}
out[path.join(delimiter)] = value;
out[key] = value;
}
}
else {
if (traverseArrays && initializeArrays && Array.isArray(value)) {
out[key] = [];
}
if (isLeaf) {
out[path.join(delimiter)] = value;
out[key] = value;
}

@@ -29,0 +35,0 @@ }

@@ -94,5 +94,7 @@ 'use strict';

var out = flatten({ foo: ['a', 'b', 'c'] }, {
traverseArrays: true
traverseArrays: true,
initializeArrays: true,
});
expect(out).to.eql({
'foo': [],
'foo.0': 'a',

@@ -99,0 +101,0 @@ 'foo.1': 'b',

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