23 lines
497 B
JavaScript
23 lines
497 B
JavaScript
'use strict';
|
|
|
|
function defineProperty(object, name, value) {
|
|
Object.defineProperty(object, name, {
|
|
enumerable: true,
|
|
value: value,
|
|
writable: false,
|
|
});
|
|
}
|
|
|
|
function defineFrozen(object, name, value) {
|
|
var frozen = JSON.stringify(value);
|
|
Object.defineProperty(object, name, {
|
|
enumerable: true,
|
|
get: function() { return JSON.parse(frozen); }
|
|
});
|
|
}
|
|
|
|
module.exports = {
|
|
defineFrozen: defineFrozen,
|
|
defineProperty: defineProperty,
|
|
};
|