mirror of
https://github.com/CamHenlin/MessagesForMacintosh.git
synced 2024-12-04 10:50:39 +00:00
25 lines
835 B
JavaScript
25 lines
835 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var environment_1 = require("./environment");
|
|
function deepFreeze(o) {
|
|
Object.freeze(o);
|
|
Object.getOwnPropertyNames(o).forEach(function (prop) {
|
|
if (o[prop] !== null &&
|
|
(typeof o[prop] === 'object' || typeof o[prop] === 'function') &&
|
|
!Object.isFrozen(o[prop])) {
|
|
deepFreeze(o[prop]);
|
|
}
|
|
});
|
|
return o;
|
|
}
|
|
function maybeDeepFreeze(obj) {
|
|
if (environment_1.isDevelopment() || environment_1.isTest()) {
|
|
var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string';
|
|
if (!symbolIsPolyfilled) {
|
|
return deepFreeze(obj);
|
|
}
|
|
}
|
|
return obj;
|
|
}
|
|
exports.maybeDeepFreeze = maybeDeepFreeze;
|
|
//# sourceMappingURL=maybeDeepFreeze.js.map
|