toObjMap.js 695 B

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = toObjMap;
  6. var _objectEntries3 = _interopRequireDefault(require("../polyfills/objectEntries"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. function toObjMap(obj) {
  9. /* eslint-enable no-redeclare */
  10. if (Object.getPrototypeOf(obj) === null) {
  11. return obj;
  12. }
  13. var map = Object.create(null);
  14. for (var _i2 = 0, _objectEntries2 = (0, _objectEntries3.default)(obj); _i2 < _objectEntries2.length; _i2++) {
  15. var _ref2 = _objectEntries2[_i2];
  16. var key = _ref2[0];
  17. var value = _ref2[1];
  18. map[key] = value;
  19. }
  20. return map;
  21. }