defineProperty.js 257 B

1234567891011121314
  1. export default (function (obj, key, value) {
  2. if (key in obj) {
  3. Object.defineProperty(obj, key, {
  4. value: value,
  5. enumerable: true,
  6. configurable: true,
  7. writable: true
  8. });
  9. } else {
  10. obj[key] = value;
  11. }
  12. return obj;
  13. });