In JavaScript we have a few ways of getting the properties of an object, depending on what we want to get.
1) Object.keys(), which returns all own, enu
An implementation in my personal preferences :)
function getAllProperties(In, Out = {}) {
const keys = Object.getOwnPropertyNames(In);
keys.forEach(key => Object.defineProperty(In, key, {
enumerable: true
}));
Out = { ...In, ...Out };
const Prototype = Object.getPrototypeOf(In);
return Prototype === Object.prototype ? Out : getAllProperties(Proto, Out);
}