UNPKG

firestore-snapshot-utils

Version:

[![github license](https://img.shields.io/github/license/ericvera/firestore-snapshot-utils.svg?style=flat-square)](https://github.com/ericvera/firestore-snapshot-utils/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/firestore-snapshot-ut

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; };