fast-redact
Advanced tools
Comparing version 1.1.4 to 1.1.5
@@ -15,2 +15,1 @@ 'use strict' | ||
console.log(redact(fauxRequest)) | ||
@@ -11,2 +11,2 @@ 'use strict' | ||
} | ||
console.log(redact(obj)) | ||
console.log(redact(obj)) |
'use strict' | ||
const fastRedact = require('..') | ||
const redact = fastRedact({ | ||
paths: ['a'], | ||
paths: ['a'], | ||
serialize: false | ||
@@ -11,2 +11,2 @@ }) | ||
console.log(redact.restore(o) === o) | ||
console.log(o) | ||
console.log(o) |
'use strict' | ||
const fastRedact = require('..') | ||
const redact = fastRedact({paths: ['a'], serialize: (o) => JSON.stringify(o, 0, 2)}) | ||
console.log(redact({a: 1, b: 2})) | ||
console.log(redact({a: 1, b: 2})) |
@@ -9,2 +9,2 @@ 'use strict' | ||
} | ||
console.log(redact(obj)) | ||
console.log(redact(obj)) |
10
index.js
@@ -23,4 +23,4 @@ 'use strict' | ||
const serialize = 'serialize' in opts ? ( | ||
opts.serialize === false ? opts.serialize : | ||
(typeof opts.serialize === 'function' ? opts.serialize : JSON.stringify) | ||
opts.serialize === false ? opts.serialize | ||
: (typeof opts.serialize === 'function' ? opts.serialize : JSON.stringify) | ||
) : JSON.stringify | ||
@@ -31,5 +31,5 @@ const remove = opts.remove | ||
} | ||
const censor = remove === true ? | ||
undefined : | ||
'censor' in opts ? opts.censor : DEFAULT_CENSOR | ||
const censor = remove === true | ||
? undefined | ||
: 'censor' in opts ? opts.censor : DEFAULT_CENSOR | ||
@@ -36,0 +36,0 @@ if (paths.length === 0) return serialize || noop |
@@ -32,6 +32,6 @@ 'use strict' | ||
o[strPath] = { | ||
path: path, | ||
val: null, | ||
path: path, | ||
val: null, | ||
precensored: false, | ||
circle: '', | ||
circle: '', | ||
escPath: JSON.stringify(strPath) | ||
@@ -38,0 +38,0 @@ } |
@@ -28,3 +28,2 @@ 'use strict' | ||
if (/\/\*/.test(expr)) throw Error() | ||
/* eslint-disable-next-line */ | ||
runInContext(` | ||
@@ -35,3 +34,3 @@ (function ( | ||
Int16Array, Int32Array, Int8Array, Intl, JSON, Map, | ||
Math, NaN, Number, Object, Promise, Proxy, RangeError, | ||
Math, Number, Object, Promise, Proxy, RangeError, | ||
ReferenceError, Reflect, RegExp, Set, SharedArrayBuffer, | ||
@@ -38,0 +37,0 @@ String, Symbol, SyntaxError, TypeError, URIError, |
{ | ||
"name": "fast-redact", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "very fast object redaction", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -189,3 +189,2 @@ 'use strict' | ||
test('removes during serialization instead of redacting when remove option is true', ({end, is}) => { | ||
@@ -192,0 +191,0 @@ const redact = fastRedact({paths: ['a'], remove: true}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1156
51556