mirror of
https://github.com/swc-project/swc.git
synced 2024-12-30 09:03:37 +03:00
18 lines
411 B
TypeScript
18 lines
411 B
TypeScript
// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/toObjMap.js
|
|
|
|
|
|
import objectEntries from '../polyfills/objectEntries.js';
|
|
export default function toObjMap(obj) {
|
|
/* eslint-enable no-redeclare */
|
|
if (Object.getPrototypeOf(obj) === null) {
|
|
return obj;
|
|
}
|
|
|
|
const map = Object.create(null);
|
|
|
|
for (const [key, value] of objectEntries(obj)) {
|
|
map[key] = value;
|
|
}
|
|
|
|
return map;
|
|
} |