13 lines
276 B
JavaScript
13 lines
276 B
JavaScript
'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);
|
|
};
|