You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
391 B
24 lines
391 B
'use strict'; |
|
|
|
Object.defineProperty(exports, '__esModule', { |
|
value: true, |
|
}); |
|
exports.toObjMap = toObjMap; |
|
|
|
function toObjMap(obj) { |
|
if (obj == null) { |
|
return Object.create(null); |
|
} |
|
|
|
if (Object.getPrototypeOf(obj) === null) { |
|
return obj; |
|
} |
|
|
|
const map = Object.create(null); |
|
|
|
for (const [key, value] of Object.entries(obj)) { |
|
map[key] = value; |
|
} |
|
|
|
return map; |
|
}
|
|
|