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

deepdash

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deepdash - npm Package Compare versions

Comparing version 1.3.2 to 1.4.0

test/issues.js

4

deepdash.js

@@ -92,2 +92,3 @@ 'use strict';

includeCircularPath: true,
leafsOnly:false
},

@@ -117,2 +118,5 @@ options || {}

if(!circular||options.includeCircularPath){
if(options.leafsOnly && _.last(res)===parentPath){
res.pop();
}
res.push(path);

@@ -119,0 +123,0 @@ }

4

package.json
{
"name": "deepdash",
"version": "1.3.2",
"version": "1.4.0",
"description": "Object tree traversal for lodash",

@@ -21,4 +21,2 @@ "main": "deepdash.js",

"object",
"traversal",
"lodash",
"tree",

@@ -25,0 +23,0 @@ "traversal",

@@ -150,3 +150,4 @@ <img src="deepdash.svg?sanitize=true" width="64px"/>

- \[checkCircular\]: (Boolean) option (false by default) to avoid circular references.
- \[includeCircularPath\]: (Boolean) option (true by default) return path to circular reference, if found some, or not.
- \[includeCircularPath\]: (Boolean) option (true by default) return path to circular reference, if found some, or skip it.
- \[leafsOnly\]: (Boolean) option (false by default) return paths to childless values only.

@@ -153,0 +154,0 @@ **Example:**

@@ -20,10 +20,13 @@ 'use strict';

it('Array', () => {
let keys = _.keysDeep([demo,demo]);
let keys = _.keysDeep([demo, demo]);
expect(keys.length).equal(62);
});
it('Count paths circular', () => {
let keys = _.keysDeep(circular,{checkCircular:true});
let keys = _.keysDeep(circular, { checkCircular: true });
// console.log(keys);
expect(keys.length).equal(23);
keys = _.keysDeep(circular,{checkCircular:true,includeCircularPath:false});
keys = _.keysDeep(circular, {
checkCircular: true,
includeCircularPath: false,
});
// console.log(keys);

@@ -44,16 +47,54 @@ expect(keys.length).equal(20);

let keys = _.keysDeep(1);
expect(keys).to.be.array().and.has.property('length').equal(0);
expect(keys)
.to.be.array()
.and.has.property('length')
.equal(0);
keys = _.keysDeep('123');
expect(keys).to.be.array().and.has.property('length').equal(0);
expect(keys)
.to.be.array()
.and.has.property('length')
.equal(0);
keys = _.keysDeep(null);
expect(keys).to.be.array().and.has.property('length').equal(0);
expect(keys)
.to.be.array()
.and.has.property('length')
.equal(0);
keys = _.keysDeep(undefined);
expect(keys).to.be.array().and.has.property('length').equal(0);
keys = _.keysDeep(()=>{});
expect(keys).to.be.array().and.has.property('length').equal(0);
expect(keys)
.to.be.array()
.and.has.property('length')
.equal(0);
keys = _.keysDeep(() => {});
expect(keys)
.to.be.array()
.and.has.property('length')
.equal(0);
keys = _.keysDeep(new Date());
expect(keys).to.be.array().and.has.property('length').equal(0);
expect(keys)
.to.be.array()
.and.has.property('length')
.equal(0);
keys = _.keysDeep(/.*/);
expect(keys).to.be.array().and.has.property('length').equal(0);
expect(keys)
.to.be.array()
.and.has.property('length')
.equal(0);
});
it('Leafs only', () => {
let keys = _.keysDeep(demo, { leafsOnly: true });
expect(keys.length).equal(14);
});
it('Leafs only circular', () => {
let keys = _.keysDeep(circular, { checkCircular: true, leafsOnly: true });
expect(keys.length).equal(10);
keys = _.keysDeep(circular, {
checkCircular: true,
includeCircularPath: false,
leafsOnly: true
});
expect(keys.length).equal(9);
});
});
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