Open
Description
As it sits currently, models can be very hard to read when logged due to the numerous underscored properties (which I assume to be private, "don't use this" properties). These properties are shown when logging to the console, and you have to go out of your way to hide them, or sift through them for the actual data on the model. This can be combatted with simple defineProperty
/defineProperties
call
const obj = {};
Object.defineProperty(obj, "hidden1", { value: "whatever", enumerable: false });
Object.defineProperty(obj, "_hidden2", { value: "hi", enumerable: false });
Object.defineProperties(obj, {
hidden3: {
value: "this is easy",
enumerable: false
},
_hidden4: {
value: "please my adhd is killing me",
enumerable: false
}
});
console.log(obj);
console.log(obj.hidden1);
console.log(obj._hidden2);
console.log(obj.hidden3);
console.log(obj._hidden4);
The first log shows no properties, but the next 4 clearly show them as still accessible and usable.
Metadata
Assignees
Labels
No labels
Activity