Created
August 23, 2018 12:24
-
-
Save dipunm/35968418a8947aeb2e9f60c3684e8e24 to your computer and use it in GitHub Desktop.
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
import _ from 'lodash'; | |
export default [ | |
...[ | |
{val: 1, name: 'explanations on'}, | |
{val: 2, name: 'explanations on with icon'}, | |
{val: 0, name: 'explanations off'}, | |
].map((opts) => ({ | |
name: opts.name, | |
dependencies: ['abHelper'], | |
health: new Date() > new Date('2018-09-22') ? 'CLEAN ME UP!!!' : undefined, | |
test: (abHelper) => { | |
const variant = abHelper.getVariant('sfx290', { | |
conditions: (req) => req.path.match(/^\/?s/) | |
}); | |
return opts.val === 0 ? | |
!variant : | |
variant === opts.val; | |
}, | |
})), | |
]; | |
export default [ | |
feature => Object.assign(feature, { | |
name: 'explanations on', | |
test: (...args) => feature.test(...args) === 1, | |
}), | |
feature => Object.assign(feature, { | |
name: 'explanations on with icon', | |
test: (...args) => feature.test(...args) === 2, | |
}), | |
feature => Object.assign(feature, { | |
name: 'explanations off', | |
test: (...args) => feature.test(...args) === 0, | |
}), | |
].map(transform => transform({ | |
health: new Date() > new Date('2018-09-22') ? 'CLEAN ME UP!!!' : undefined, | |
dependencies: ['abHelper'], | |
test: (abHelper) => { | |
const variant = abHelper.getVariant('sfx290', { | |
condition: (req) => req.path.match(/^\/?s/) | |
}); | |
return variant; | |
}, | |
})); | |
export default variate( | |
{ | |
health: new Date() > new Date('2018-09-22') ? 'CLEAN ME UP!!!' : undefined, | |
dependencies: ['abHelper'], | |
test: (abHelper) => { | |
const variant = abHelper.getVariant('sfx290', { | |
condition: (req) => req.path.match(/^\/?s/) | |
}); | |
return variant; | |
}, | |
}, | |
{ name: 'explanations 1', test: result => result === 1}, | |
{ name: 'explanations 2', test: result => result === 2}, | |
{ name: 'explanations 3', test: result => result === 3}, | |
); | |
export default [ | |
...expand({ | |
name: [ | |
'explanations on', | |
'explanations on with icon', | |
'explanations off', | |
], | |
health: new Date() > new Date('2018-09-22') ? 'CLEAN ME UP!!!' : undefined, | |
dependencies: ['abHelper'], | |
test: [ | |
variant => variant === 1, | |
variant => variant === 2, | |
variant => !variant || variant >= 3, | |
].map(fn => abHelper => fn(abHelper.getVariant('sfx290', { | |
condition: req => req.path.match(/^\/?s/) | |
}))) | |
}) | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment