Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redact-object

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redact-object - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

19

index.js

@@ -11,2 +11,6 @@ 'use strict';

function isFunction (value) {
return typeof value === 'function';
}
/**

@@ -16,5 +20,5 @@ * Checks for match

* @param {string} key The string to check
* @param {Boolean} strict Use strict case if true
* @param {Boolean} partial Use partial matching if true
* @return {Boolean} True for match or false
* @param {boolean} strict Use strict case if true
* @param {boolean} partial Use partial matching if true
* @return {boolean} True for match or false
*/

@@ -42,2 +46,3 @@ function isKeywordMatch (keywords, key, strict, partial) {

* strict: boolean, do strict key matching, default true
* ignoreFunctions: boolean, ignore functions instead of error, default false
* }

@@ -50,2 +55,3 @@ * @return {object} the new redacted object

const strict = config.hasOwnProperty('strict') ? config.strict : true;
const ignoreFunctions = config.hasOwnProperty('ignoreFunctions') ? config.ignoreFunctions : false;

@@ -74,5 +80,10 @@ if (!isObject(target)) {

// Redaction only works on arrays, plain objects, and primitives.
throw new Error('Unsupported value for redaction');
if (isFunction(target) && ignoreFunctions) {
// ignore the function instead of throwing an error
return target;
} else {
throw new Error('Unsupported value for redaction');
}
}
module.exports = redact;
{
"name": "redact-object",
"version": "2.1.0",
"version": "2.2.0",
"description": "Object redactor",

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

],
"author": "Shaun Buridck <github@shaunburdick.com>",
"author": "Shaun Burdick <github@shaunburdick.com>",
"contributors": [

@@ -32,7 +32,7 @@ "Parsha Pourkhomami <parshap@gmail.com>"

"devDependencies": {
"coveralls": "^3.0.1",
"jasmine-node": "^1.14.5",
"nyc": "^12.0.2",
"coveralls": "^3.0.2",
"jasmine-node": "^1.16.2",
"nyc": "^13.0.1",
"semistandard": "^12.0.1",
"snazzy": "^7.1.1"
"snazzy": "^8.0.0"
},

@@ -39,0 +39,0 @@ "homepage": "https://github.com/shaunburdick/redact-object",

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