UNPKG

strapi-plugin-rest-cache

Version:
20 lines (14 loc) 414 B
'use strict'; 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 };