toObjMap.mjs 459 B

123456789101112131415161718
  1. import objectEntries from '../polyfills/objectEntries';
  2. export default function toObjMap(obj) {
  3. /* eslint-enable no-redeclare */
  4. if (Object.getPrototypeOf(obj) === null) {
  5. return obj;
  6. }
  7. var map = Object.create(null);
  8. for (var _i2 = 0, _objectEntries2 = objectEntries(obj); _i2 < _objectEntries2.length; _i2++) {
  9. var _ref2 = _objectEntries2[_i2];
  10. var key = _ref2[0];
  11. var value = _ref2[1];
  12. map[key] = value;
  13. }
  14. return map;
  15. }