_defaults.js 491 B

12345678910111213141516
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = _defaults;
  6. function _defaults(obj, defaults) {
  7. var keys = Object.getOwnPropertyNames(defaults);
  8. for(var i = 0; i < keys.length; i++){
  9. var key = keys[i];
  10. var value = Object.getOwnPropertyDescriptor(defaults, key);
  11. if (value && value.configurable && obj[key] === undefined) {
  12. Object.defineProperty(obj, key, value);
  13. }
  14. }
  15. return obj;
  16. }