create-property.js 472 B

12345678910
  1. 'use strict';
  2. var toPropertyKey = require('../internals/to-property-key');
  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 = toPropertyKey(key);
  7. if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  8. else object[propertyKey] = value;
  9. };