0

Is there a better, less redundant way to write this.

const {
  consumer_secret,
  consumer_key,
  token,
  token_secret,
} = require('./config');

const keys = {
  consumer_key,
  consumer_secret,
  token,
  token_secret,
};
Mel
  • 625
  • 9
  • 25
  • What exactly do you want to accomplish? – Dominik Matis Mar 06 '21 at 21:39
  • @DominikMatis I was trying to deconstruct variables from ./config to the variable keys directly. I have found the solution but this question was marked as a duplicate which didn't help solve the issue. That's the solution I came up with `const keys = ({ consumerKey, consumerSecret, token, tokenSecret,} = require('./config'));` – Mel Mar 06 '21 at 21:49

0 Answers0