contentful-sdk-core
Version:
Core modules for the Contentful JS SDKs
19 lines (17 loc) • 551 B
JavaScript
// copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
function deepFreeze(object) {
const propNames = Object.getOwnPropertyNames(object);
for (const name of propNames) {
const value = object[name];
if (value && typeof value === 'object') {
deepFreeze(value);
}
}
return Object.freeze(object);
}
function freezeSys(obj) {
deepFreeze(obj.sys || {});
return obj;
}
export { freezeSys as default };
//# sourceMappingURL=freeze-sys.js.map