UNPKG

firestore-snapshot-utils

Version:
18 lines (17 loc) 498 B
// NOTE: Currently only works with props that exist in the top level of the // object export const maskProps = (a, collection, maskKeys) => { if (typeof a !== 'object' || Array.isArray(a) || a === null) { return a; } const keys = maskKeys[collection]; if (keys) { const obj = a; for (const key of keys) { if (typeof obj[key] === 'string') { obj[key] = obj[key].replace(/./g, '•'); } } } return a; };