defaults.js 462 B

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