35 lines
965 B
JavaScript
35 lines
965 B
JavaScript
|
"use strict";
|
||
|
|
||
|
exports.__esModule = true;
|
||
|
|
||
|
var _getPrototypeOf = require("../core-js/object/get-prototype-of");
|
||
|
|
||
|
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
||
|
|
||
|
var _getOwnPropertyDescriptor = require("../core-js/object/get-own-property-descriptor");
|
||
|
|
||
|
var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
|
||
|
|
||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
|
||
|
exports.default = function set(object, property, value, receiver) {
|
||
|
var desc = (0, _getOwnPropertyDescriptor2.default)(object, property);
|
||
|
|
||
|
if (desc === undefined) {
|
||
|
var parent = (0, _getPrototypeOf2.default)(object);
|
||
|
|
||
|
if (parent !== null) {
|
||
|
set(parent, property, value, receiver);
|
||
|
}
|
||
|
} else if ("value" in desc && desc.writable) {
|
||
|
desc.value = value;
|
||
|
} else {
|
||
|
var setter = desc.set;
|
||
|
|
||
|
if (setter !== undefined) {
|
||
|
setter.call(receiver, value);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return value;
|
||
|
};
|