From 49f76d27a9967cbeff0ba5b3d41277c558999472 Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 6 Oct 2017 00:04:01 -0230 Subject: Adds checkFeatureToggle util. --- ui/lib/feature-toggle-utils.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 ui/lib/feature-toggle-utils.js (limited to 'ui/lib/feature-toggle-utils.js') diff --git a/ui/lib/feature-toggle-utils.js b/ui/lib/feature-toggle-utils.js new file mode 100644 index 000000000..f4ff446d3 --- /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, +} \ No newline at end of file -- cgit From 119c2b24238b84d5a9e3beabe572da42f8e2ffcb Mon Sep 17 00:00:00 2001 From: Chi Kei Chan Date: Tue, 10 Oct 2017 14:16:57 -0700 Subject: Confirm eth v2 --- ui/lib/feature-toggle-utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui/lib/feature-toggle-utils.js') diff --git a/ui/lib/feature-toggle-utils.js b/ui/lib/feature-toggle-utils.js index f4ff446d3..6d4e461ca 100644 --- a/ui/lib/feature-toggle-utils.js +++ b/ui/lib/feature-toggle-utils.js @@ -1,4 +1,4 @@ -function checkFeatureToggle(name) { +function checkFeatureToggle (name) { const queryPairMap = window.location.search.substr(1).split('&') .map(pair => pair.split('=')) .reduce((pairs, [key, value]) => ({...pairs, [key]: value }), {}) @@ -8,4 +8,4 @@ function checkFeatureToggle(name) { module.exports = { checkFeatureToggle, -} \ No newline at end of file +} -- cgit