2018-01-27 01:44:54 +03:00
|
|
|
'use strict';
|
|
|
|
|
2017-02-24 22:57:46 +03:00
|
|
|
function defineProperty(object, name, value) {
|
|
|
|
Object.defineProperty(object, name, {
|
|
|
|
enumerable: true,
|
|
|
|
value: value,
|
|
|
|
writable: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-03-05 03:31:09 +03:00
|
|
|
function defineFrozen(object, name, value) {
|
|
|
|
var frozen = JSON.stringify(value);
|
|
|
|
Object.defineProperty(object, name, {
|
|
|
|
enumerable: true,
|
|
|
|
get: function() { return JSON.parse(frozen); }
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-02-24 22:57:46 +03:00
|
|
|
module.exports = {
|
2018-03-05 03:31:09 +03:00
|
|
|
defineFrozen: defineFrozen,
|
2017-02-24 22:57:46 +03:00
|
|
|
defineProperty: defineProperty,
|
|
|
|
};
|