create-property.js 465 B

12345678910
  1. 'use strict';
  2. var toPrimitive = require('../internals/to-primitive');
  3. var definePropertyModule = require('../internals/object-define-property');
  4. var createPropertyDescriptor = require('../internals/create-property-descriptor');
  5. module.exports = function (object, key, value) {
  6. var propertyKey = toPrimitive(key);
  7. if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  8. else object[propertyKey] = value;
  9. };