Lodash: Is there a Lodash Function which will mask the values of provided keys ?

Created on 19 Sep 2016  路  3Comments  路  Source: lodash/lodash

We log our payloads so we want to mask the keys of PII and PCI related information, like SSN/PIN and so forth...

I came up with JSON.stringify solution, but wasn't able to find something like _.mask(object/array,['pin','ssn'], *)..

May be there might be a solution available combining multiple methods ?

Thanks,
Sameer

question

All 3 comments

Hi @SameerSiddiqui!

We have _.mapKeys or _.mapValues.
Don't forget to check out our gitter chat for help too.

Yeah, but i just noticed. it will not handle Arrays

_.mapKeys(object, [iteratee=_.identity])

anyPlans to make to compatible ? _.map does takes array why _.mapKeys does not ?

Thanks,
Sameer

No plans.

_.mapKeys and _.mapValues are specialized for objects. _.map is a collection method which will iterate over array-likes and objects.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jcubic picture jcubic  路  3Comments

toranb picture toranb  路  3Comments

dwoldrich picture dwoldrich  路  3Comments

ryyppy picture ryyppy  路  3Comments

JoMas971 picture JoMas971  路  3Comments