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.5.0 to 2.0.0

2

lib/rx.js
'use strict'
module.exports = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))$/g
module.exports = /[^.[\]]+|\[((?:.)*?)\]/g
{
"name": "fast-redact",
"version": "1.5.0",
"version": "2.0.0",
"description": "very fast object redaction",

@@ -8,3 +8,3 @@ "main": "index.js",

"test": "tap test",
"pretest": "standard index.js 'lib/*.js' 'example/*.js' benchmark/index.js test/index.js | snazzy",
"posttest": "standard index.js 'lib/*.js' 'example/*.js' benchmark/index.js test/index.js | snazzy",
"cov": "tap --cov test",

@@ -11,0 +11,0 @@ "cov-ui": "tap --coverage-report=html test",

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

})
test('handles keys with dots', ({ end, is }) => {
const redactSingleQ = fastRedact({ paths: [`a['b.c']`], serialize: false })
const redactDoubleQ = fastRedact({ paths: [`a["b.c"]`], serialize: false })
const redactBacktickQ = fastRedact({ paths: ['a[`b.c`]'], serialize: false })
const redactNum = fastRedact({ paths: [`a[-1.2]`], serialize: false })
const redactLeading = fastRedact({ paths: [`["b.c"]`], serialize: false })
is(redactSingleQ({ a: { 'b.c': 'x', '-1.2': 'x' } }).a['b.c'], censor)
is(redactDoubleQ({ a: { 'b.c': 'x', '-1.2': 'x' } }).a['b.c'], censor)
is(redactBacktickQ({ a: { 'b.c': 'x', '-1.2': 'x' } }).a['b.c'], censor)
is(redactNum({ a: { 'b.c': 'x', '-1.2': 'x' } }).a['-1.2'], censor)
is(redactLeading({ 'b.c': 'x', '-1.2': 'x' })['b.c'], censor)
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