Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle arrays, other improvements #1

Merged
merged 7 commits into from Aug 31, 2016

Conversation

parshap
Copy link
Contributor

@parshap parshap commented Aug 31, 2016

This implements various changes I needed for my use case. Notably:

  • Support arrays, returning a new array instead of converting it to an object
  • Throw error if given value is not array or plain object — see de0b439 for more info
  • Substring and case-insensitive matching — for example, if "AUTH-TOKEN" is the key, and one of the keywords is "token", then the "AUTH-TOKEN" key will be redacted

Prevents pulling in all of util module source for bundled builds (e.g.,
when using webpack).
For example, if the key is "auth-token" and one of the keywords is
"token", then the "auth-token" key will be redacted.
Running redact on a non-plain object (an object with a prototype, e.g.,
an instance of http.IncomingMessage) may result in unexpected behavior
due to the prototype chain and non-enumerable properties.
@shaunburdick shaunburdick merged commit 9c82913 into shaunburdick:master Aug 31, 2016
@shaunburdick
Copy link
Owner

I like it. The only issue I have is that it doesn't do partial matching and you are adding that. To make it backwards compatible, I would want to put that feature behind a flag. I will merge this then add the flag.

Thanks for your contribution!

@shaunburdick
Copy link
Owner

Pushed these changes to NPM as 2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants