strapi-plugin-rest-cache
Version:
Speed-up HTTP requests with LRU cache
20 lines (14 loc) • 414 B
JavaScript
;
function deepFreeze(object) {
// Retrieve the property names defined on object
const propNames = Object.getOwnPropertyNames(object);
// Freeze properties before freezing self
for (const name of propNames) {
const value = object[name];
if (value && typeof value === 'object') {
deepFreeze(value);
}
}
return Object.freeze(object);
}
module.exports = { deepFreeze };