mirror of
https://github.com/getredash/redash.git
synced 2026-03-21 16:00:09 -04:00
* Prettier all the JS files * Add GitHub Action to autoformat code pushed to master * Fix eslint violation due to formatting. * Remove GitHub actions for styling * Add restyled.io config
21 lines
511 B
JavaScript
21 lines
511 B
JavaScript
import { toNumber, isNull } from "lodash";
|
|
import { Parameter } from ".";
|
|
|
|
class NumberParameter extends Parameter {
|
|
constructor(parameter, parentQueryId) {
|
|
super(parameter, parentQueryId);
|
|
this.setValue(parameter.value);
|
|
}
|
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
normalizeValue(value) {
|
|
if (isNull(value)) {
|
|
return null;
|
|
}
|
|
const normalizedValue = toNumber(value);
|
|
return !isNaN(normalizedValue) ? normalizedValue : null;
|
|
}
|
|
}
|
|
|
|
export default NumberParameter;
|