--- /dev/null
+'use strict';
+
+const { common } = require('@squeep/api-dingus');
+
+
+/**
+ * Recursively freeze an object.
+ * @param {Object} o
+ * @returns {Object}
+ */
+const freezeDeep = (o) => {
+ Object.freeze(o);
+ Object.getOwnPropertyNames(o).forEach((prop) => {
+ if (Object.hasOwnProperty.call(o, prop)
+ && ['object', 'function'].includes(typeof o[prop]) // eslint-disable-line security/detect-object-injection
+ && !Object.isFrozen(o[prop])) { // eslint-disable-line security/detect-object-injection
+ return freezeDeep(o[prop]); // eslint-disable-line security/detect-object-injection
+ }
+ });
+ return o;
+}
+
+module.exports = Object.assign(Object.create(common), {
+ freezeDeep,
+});
\ No newline at end of file