Is there a way to destructure an object in JavaScript and alias the local destructured object?
Something like:
const env = {ENV_VAR_X, ENV_VAR_Y, ENV_VAR_Z} = process.env;
...and have env
become a local constant containing those selected environment variables. (I'm aware that my example doesn't work with babel)
{
ENV_VAR_X: "s867c7dsj4lal7",
ENV_VAR_Y: "hd73m20s-a=snf77f",
ENV_VAR_Z: "production"
}
Is there a way to achieve this aliasing?
On a side note, I'm using babel as my transpiler, then running the script with node so that I can leverage more ECMAScript 6 functionality.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With