Socket
Socket
Sign inDemoInstall

fast-redact

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-redact - npm Package Compare versions

Comparing version 1.1.11 to 1.1.12

coverage/lcov-report/base.css

2

lib/modifiers.js

@@ -82,3 +82,3 @@ 'use strict'

nv = (i !== li) ? ov : nv
n[k] = (has(n, k) && nv === ov) || typeof nv === 'undefined' ? n[k] : nv
n[k] = (has(n, k) && nv === ov) || (nv === undefined && v !== undefined) ? n[k] : nv
n = n[k]

@@ -85,0 +85,0 @@ if (typeof n !== 'object') break

@@ -38,3 +38,2 @@ 'use strict'

}
var existence = hops.map((p) => `o.${p}`).join(' && ')

@@ -45,22 +44,22 @@ if (existence.length === 0) existence += `o.${path} != null`

const circularDetection = `
switch (true) {
${hops.reverse().map((p) => `
case o.${p} === censor:
secret[${escPath}].circle = ${JSON.stringify(p)}
break
`).join('\n')}
}
`
switch (true) {
${hops.reverse().map((p) => `
case o.${p} === censor:
secret[${escPath}].circle = ${JSON.stringify(p)}
break
`).join('\n')}
}
`
return `
if (${existence}) {
const val = o.${path}
if (val === censor) {
secret[${escPath}].precensored = true
} else {
secret[${escPath}].val = val
o.${path} = censor
${circularDetection}
}
if (${existence}) {
const val = o.${path}
if (val === censor) {
secret[${escPath}].precensored = true
} else {
secret[${escPath}].val = val
o.${path} = censor
${circularDetection}
}
`
}
`
}).join('\n')

@@ -67,0 +66,0 @@ }

{
"name": "fast-redact",
"version": "1.1.11",
"version": "1.1.12",
"description": "very fast object redaction",

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

@@ -710,1 +710,15 @@ 'use strict'

})
test('parent wildcards – removes during serialization instead of redacting when remove option is true', ({end, is}) => {
const redact = fastRedact({paths: ['a.*.c'], remove: true})
const o = {a: {b: {c: 'c'}, x: {c: 1}}}
is(redact(o), `{"a":{"b":{},"x":{}}}`)
end()
})
test('ultimate wildcards – removes during serialization instead of redacting when remove option is true', ({end, is}) => {
const redact = fastRedact({paths: ['a.b.*'], remove: true})
const o = {a: {b: {c: 'c'}, x: {c: 1}}}
is(redact(o), `{"a":{"b":{},"x":{"c":1}}}`)
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