aboutsummaryrefslogtreecommitdiffstats
path: root/ui/lib/feature-toggle-utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/lib/feature-toggle-utils.js')
-rw-r--r--ui/lib/feature-toggle-utils.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/ui/lib/feature-toggle-utils.js b/ui/lib/feature-toggle-utils.js
new file mode 100644
index 000000000..6d4e461ca
--- /dev/null
+++ b/ui/lib/feature-toggle-utils.js
@@ -0,0 +1,11 @@
+function checkFeatureToggle (name) {
+ const queryPairMap = window.location.search.substr(1).split('&')
+ .map(pair => pair.split('='))
+ .reduce((pairs, [key, value]) => ({...pairs, [key]: value }), {})
+ const featureToggles = queryPairMap['ft'] ? queryPairMap['ft'].split(',') : []
+ return Boolean(featureToggles.find(ft => ft === name))
+}
+
+module.exports = {
+ checkFeatureToggle,
+}