deep-freeze.js 276 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 12 '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); };