Socket
Socket
Sign inDemoInstall

fast-redact

Package Overview
Dependencies
Maintainers
2
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 3.4.1 to 3.5.0

4

lib/modifiers.js

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

function groupRestore ({ keys, values, target }) {
if (target == null) return
if (target == null || typeof target === 'string') return
const length = keys.length

@@ -22,3 +22,3 @@ for (var i = 0; i < length; i++) {

const target = get(o, path)
if (target == null) return { keys: null, values: null, target: null, flat: true }
if (target == null || typeof target === 'string') return { keys: null, values: null, target, flat: true }
const keys = Object.keys(target)

@@ -25,0 +25,0 @@ const keysLength = keys.length

{
"name": "fast-redact",
"version": "3.4.1",
"version": "3.5.0",
"description": "very fast object redaction",

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

@@ -92,2 +92,31 @@ 'use strict'

test('returns original value when passed non-object at wildcard key', ({ end, doesNotThrow, strictSame }) => {
const redactSerializeFalse = fastRedact({
paths: ['a.*'],
strict: false,
serialize: false
})
const primitives = [null, undefined, 'A', 1, false]
primitives.forEach((a) => {
doesNotThrow(() => redactSerializeFalse({ a }))
const res = redactSerializeFalse({ a })
strictSame(res, { a })
})
end()
})
test('returns censored values when passed array at wildcard key', ({ end, strictSame }) => {
const redactSerializeFalse = fastRedact({
paths: ['a.*'],
strict: false,
serialize: false
})
const res = redactSerializeFalse({ a: ['redact', 'me'] })
strictSame(res.a, [censor, censor])
end()
})
test('throws if a path is not a string', ({ end, throws }) => {

@@ -94,0 +123,0 @@ const invalidTypeMsg = 'fast-redact - Paths must be (non-empty) strings'

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