Given a class:
class Something {    
  constructor(something) {
   this._something = something; 
  }
  get something() {
    return this._something;
  }
}
I want to be able to spread the accessor values into a new object, for example:
const somethingObject = new Something(12);
const somethingSpread = { ...somethingObject };
However, it only outputs the class's _something attribute:
{ _something: 12 }
But what I'm looking for is something like this:
{ something: 12 }
I also tried with Object.assign, which gives the same output as above:
const somethingAssigned = Object.assign({}, somethingObject);
// Output: { _something: 12 }
Is it possible to accomplish this?
 
     
     
    