const freezeDeep = (o) => {
Object.freeze(o);
Object.getOwnPropertyNames(o).forEach((prop) => {
- if (Object.hasOwnProperty.call(o, prop)
+ if (Object.hasOwn(o, prop)
&& ['object', 'function'].includes(typeof o[prop]) // eslint-disable-line security/detect-object-injection
&& !Object.isFrozen(o[prop])) { // eslint-disable-line security/detect-object-injection
return freezeDeep(o[prop]); // eslint-disable-line security/detect-object-injection