Last active
April 23, 2018 20:43
-
-
Save richcsmith/2ecdeb634e83ef858450f267ec433336 to your computer and use it in GitHub Desktop.
Quick & dirty feature flag implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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