defaults.js 995 B

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. exports.__esModule = true;
  3. var _defineProperty = require("../core-js/object/define-property");
  4. var _defineProperty2 = _interopRequireDefault(_defineProperty);
  5. var _getOwnPropertyDescriptor = require("../core-js/object/get-own-property-descriptor");
  6. var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
  7. var _getOwnPropertyNames = require("../core-js/object/get-own-property-names");
  8. var _getOwnPropertyNames2 = _interopRequireDefault(_getOwnPropertyNames);
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. exports.default = function (obj, defaults) {
  11. var keys = (0, _getOwnPropertyNames2.default)(defaults);
  12. for (var i = 0; i < keys.length; i++) {
  13. var key = keys[i];
  14. var value = (0, _getOwnPropertyDescriptor2.default)(defaults, key);
  15. if (value && value.configurable && obj[key] === undefined) {
  16. (0, _defineProperty2.default)(obj, key, value);
  17. }
  18. }
  19. return obj;
  20. };