Skip to content

Instantly share code, notes, and snippets.

@dsetzer
Last active December 22, 2019 13:09
Show Gist options
  • Save dsetzer/d65158ed4f78772c7c4d0748f4a178f7 to your computer and use it in GitHub Desktop.
Save dsetzer/d65158ed4f78772c7c4d0748f4a178f7 to your computer and use it in GitHub Desktop.
Making config values easier to work with
var config = {
baseBet: { type: 'balance', label: 'Base Bet', value: 100 }
};
// Add config values to global scope
Object.entries(config).forEach(c=>window[c[0]]=c[1].value);
// Before:
//await this.log(config.baseBet.value);
// After:
// await this.log(baseBet);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment