defaults.js 684 B

123456789101112131415161718
  1. import _Object$getOwnPropertyNames from "@babel/runtime-corejs3/core-js/object/get-own-property-names";
  2. import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js/object/get-own-property-descriptor";
  3. import _Object$defineProperty from "@babel/runtime-corejs3/core-js/object/define-property";
  4. export default function _defaults(obj, defaults) {
  5. var keys = _Object$getOwnPropertyNames(defaults);
  6. for (var i = 0; i < keys.length; i++) {
  7. var key = keys[i];
  8. var value = _Object$getOwnPropertyDescriptor(defaults, key);
  9. if (value && value.configurable && obj[key] === undefined) {
  10. _Object$defineProperty(obj, key, value);
  11. }
  12. }
  13. return obj;
  14. }