2020-09-05 22:50:45 +02:00
|
|
|
/**
|
|
|
|
* Recreate the given object without the __proto__. Useful for better formatting when output in console.
|
|
|
|
* @param obj The object to recreate
|
|
|
|
*/
|
|
|
|
export default function cloneNullProto<Obj=any>(obj:Obj):Obj{
|
|
|
|
let o = Object.create(null)
|
|
|
|
Object.keys(obj).forEach(k => {
|
|
|
|
o[k] = obj[k]
|
|
|
|
})
|
|
|
|
return o
|
2020-07-04 22:42:26 +02:00
|
|
|
}
|