Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const update = (name, newValue, evt) => {
newValue = roundMm(newValue, props.units);
// Sometimes, when sliding, the rapid succession of updates
// causes a weird timing issue to result in a value that is NaN.
// If that's the case, just ignore this update and keep the
// previous one instead
if (!isNaN(newValue)) {
setValue(newValue);
if (evt.type !== "mousemove") props.updateValue(props.name, newValue);
} else {
if (evt.type !== "mousemove") props.updateValue(props.name, value);
}
};
const update = (name, newValue, evt) => {
newValue = roundMm(newValue)
// Sometimes, when sliding, the rapid succession of updates
// causes a weird timing issue to result in a value that is NaN.
// If that's the case, just ignore this update and keep the
// previous one instead
if (!isNaN(newValue)) {
setValue(newValue)
if (evt.type !== 'mousemove') props.updateValue('margin', newValue)
} else {
props.updateValue('margin', value)
}
}
const updateCustom = (name, newValue, evt) => {
newValue = roundMm(newValue)
// Sometimes, when sliding, the rapid succession of updates
// causes a weird timing issue to result in a value that is NaN.
// If that's the case, just ignore this update and keep the
// previous one instead
if (!isNaN(newValue)) {
setSaValue(newValue)
setCustomValue(newValue)
if (evt.type !== 'mousemove') props.updateValue('sa', newValue)
} else {
props.updateValue('sa', customValue)
}
}
const saveMeasurements = data => {
storage.set(props.config.name + "-measurements", data);
props.updateGist(data, "settings", "measurements");
};
const updateMeasurement = (name, val) => {
const saveDisplay = d => {
setDisplay(d);
storage.set(props.config.name + "-display", d);
};
const getMeasurements = () =>
const renderOption = (name, sub = false) => {
let option = props.config.options[name]
let type = optionType(option)
let stringKey = `options.${props.config.name}.${name}.`
let extraProps = {
name,
dflt: optionDefault(name, props.config.options[name], props.recipe),
patternDflt: optionDefault(name, props.config.options[name]),
units: props.units,
updateValue: props.updateValue,
raiseEvent: props.raiseEvent,
title: ,
desc: ,
intl: props.intl,
pattern: props.config.name,
key: name,
noDocs: props.noDocs
}
if (
typeof props.gist !== 'undefined' &&
typeof props.gist.settings !== 'undefined' &&
typeof props.gist.settings.options !== 'undefined' &&
typeof props.gist.settings.options[name] !== 'undefined'
)
const renderOption = (name, sub = false) => {
let option = props.config.options[name]
let type = optionType(option)
let stringKey = `options.${props.config.name}.${name}.`
let extraProps = {
name,
dflt: optionDefault(name, props.config.options[name], props.recipe),
patternDflt: optionDefault(name, props.config.options[name]),
units: props.units,
updateValue: props.updateValue,
raiseEvent: props.raiseEvent,
title: ,
desc: ,
intl: props.intl,
pattern: props.config.name,
key: name,
noDocs: props.noDocs
}
if (
typeof props.gist !== 'undefined' &&
typeof props.gist.settings !== 'undefined' &&
typeof props.gist.settings.options !== 'undefined' &&
typeof props.gist.settings.options[name] !== 'undefined'
setGist(gist) {
this.setState({ gist });
if (settings.store) storage.set(this.state.gist.name || "gist", gist);
}
setStorageData(data) {
storage.set(name, data);
}
updateGist(value, l1 = false, l2 = false, l3 = false) {
if (!l1) return;
let gist = this.state.gist;
if (l2 && typeof gist[l1] === "undefined") gist[l1] = {};
if (l3 && typeof gist[l1][l2] === "undefined") gist[l1][l2] = {};
if (l3) gist[l1][l2][l3] = value;
else if (l2) gist[l1][l2] = value;
else gist[l1] = value;
this.setState({ gist });
if (settings.store) storage.set(this.state.gist.name || "gist", gist);
}