Skip to content

Instantly share code, notes, and snippets.

@richcsmith
Last active April 23, 2018 20:43
Show Gist options
  • Save richcsmith/2ecdeb634e83ef858450f267ec433336 to your computer and use it in GitHub Desktop.
Save richcsmith/2ecdeb634e83ef858450f267ec433336 to your computer and use it in GitHub Desktop.
Quick & dirty feature flag implementation
const isLocal = process.env.ENV === 'dev';
const isTest = process.env.ENV === 'test';
const isProd = process.env.ENV === 'prod';
const featureFlags = {
NewCampaignEdit: () => !isProd,
};
const isFeatureEnabled = (name = '') =>
{}.hasOwnProperty(featureFlags, name) && featureFlags[name]();
export default isFeatureEnabled;
//////////////////
if (isFeatureEnabled('NewCampaignEdit')) {
// do something
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment