To circumvent the JavaScript delete
operator (source: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Operators/delete), I have opted to utilize object destructuring to eliminate private properties:
//sample helper-function in ts
const sanitizeUser = (user: User): UserSanotized => {
const { googleData, ...rest } = user
return rest
}
I am curious whether it is safe to use the returned value of sanitizeUser
, ensuring that the googleData
property cannot be retrieved.