defaults.js 650 B

1234567891011121314151617181920212223
  1. var _Object$defineProperty = require("../core-js/object/define-property");
  2. var _Object$getOwnPropertyDescriptor = require("../core-js/object/get-own-property-descriptor");
  3. var _Object$getOwnPropertyNames = require("../core-js/object/get-own-property-names");
  4. 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. }
  15. module.exports = _defaults;