I have a function ValidateInteger
, that returns an object which looks something like:
{
Value: "123",
Neg: false,
Exp: 3
}
I also have a class which calls this function:
class MyClass {
constructor(val) {
{
Value: this.Value
Neg: this.Neg
Exp: this.Exp
} = ValidateInteger(val);
}
}
As you can see, there's quite a bit repetition with the this
.
My question is there some better syntax to do this, something like:
this.{Value, Neg, Exp} = ValidateInteger(val);
There surely should be some better syntax for this.