Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getRandomState() {
// get & hydrate the template which shuffles all the possible choices
return _.mapValues(_.cloneDeep(DEFAULTS.stateChoices), sampleChoices);
}
_onShuffleOption = (key) => {
if(!_.has(DEFAULTS.stateChoices, key)) return;
this.setState(
{
[key]: this._getRandomOption(key),
screenId: +(new Date())
},
this._saveStateToUrl
);
};
_onShuffleOptions = () => {
_getRandomOption = (key) => {
const option = sampleChoices(DEFAULTS.stateChoices[key]);
if(key === 'domain')
option.x = option.x || this._xDomainFromYDomain(option.y);
return option;
};