Questionnaire-of-the-Facebo.../node_modules/got/source/utils/deep-freeze.js

13 lines
276 B
JavaScript
Raw Normal View History

2021-03-11 01:43:28 +00:00
'use strict';
const is = require('@sindresorhus/is');
module.exports = function deepFreeze(object) {
for (const [key, value] of Object.entries(object)) {
if (is.plainObject(value) || is.array(value)) {
deepFreeze(object[key]);
}
}
return Object.freeze(object);
};