Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// Final config.js
export default class {
init() {
this.config = // ... load the object ...
// For posterity, but we don't need to return it at the moment.
return this.config;
settingExists( key ) {
let found = Object.keys( this.config ).indexOf( key )
return found;
static printFormatInstructions() {
console.log('Your config file must be in json format, and contain the following keys: foo, bar, baz.');
// Final usage
import Config from 'config.js';
// Later
if ( ! Config.settingExists( 'foo' ) ) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.