New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

breadth-filter

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

breadth-filter - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

6

index.js

@@ -16,2 +16,3 @@ const entries = require('object.entries')

const queue = [[ root, target, [] ]]
const seen = new Set()
let item

@@ -25,2 +26,7 @@

if (newTarget) {
if (!seen.has(value)) {
seen.add(value)
} else {
continue
}
target[key] = newTarget

@@ -27,0 +33,0 @@ queue.push([ value, target[key], fieldPath ])

2

package.json
{
"name": "breadth-filter",
"version": "1.1.2",
"version": "1.2.0",
"description": "Breadth-first deep object filter",

@@ -5,0 +5,0 @@ "author": "Stephen Belanger <admin@stephenbelanger.com> (https://github.com/qard)",

@@ -172,1 +172,32 @@ const tap = require('tap')

})
tap.test('gracefully handle circular references', (t) => {
const input = {
foo: {
bar: {
baz: 'buz'
},
bux: 'bax'
}
}
// Form a circular reference
input.foo.input = input
breadthFilter(input, reverse, true)
const expected = {
foo: {
bar: {
baz: 'zub'
},
bux: 'xab'
}
}
// The expectation also needs a circular reference
expected.foo.input = expected
t.deepEqual(input, expected, 'matches expected output')
t.end()
})
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