Is it possible to take an object (with many keys) and destructure the entire object just using its default key values? (Without typing all of the keys)
For example:
let myObject = {
foo: "value1",
bar: "value2",
};
const (do something special here?) = myObject;
console.log(foo); // "value1"
console.log(bar); // "value2"
This is NOT a question on how to do a regular destructure, I know how to do trivial destructuring like:
const {foo, bar} = myObject;
But for objects with 15+ keys and I know I want to use most of the values I am wondering if there is a way to destructure the object and just use the default key names from the object.