Skip to content

Commit

Permalink
Fix lodash breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuno Sousa committed Mar 23, 2017
1 parent 0917659 commit 94b2e93
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@
* Module dependencies.
*/

const _ = require('lodash');
const { assign, cloneDeepWith, includes, isObject } = require('lodash');

/**
* Export `maskJson` function.
*/

module.exports = function maskJson(collection, options) {
options = _.assign({
options = assign({
replacement: '--REDACTED--'
}, options);

return function(values) {
return _.cloneDeep(values, (value, key) => {
return cloneDeepWith(values, (value, key) => {
// Strip matching keys.
if (_.contains(collection, key)) {
if (includes(collection, key)) {
return options.replacement;
}

// Allow cloneDeep to recurse into nested objects.
if (_.isObject(value)) {
if (isObject(value)) {
return;
}

Expand Down

0 comments on commit 94b2e93

Please sign in to comment.