Skip to content

Commit

Permalink
fix: change all Number.isNaN() to isNaN()
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkiMeganMoore committed Oct 6, 2022
1 parent 183dbe2 commit 01c6dc0
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 20 deletions.
Binary file modified example/package/react-autoql-0.0.0-semantically-released.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion src/components/Charts/Bars/Bars.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class Bars extends Component {
}

let width = Math.abs(xScale(value) - scaleZero(xScale))
if (Number.isNaN(width)) {
if (isNaN(width)) {
width = 0
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/Charts/Circles/Circles.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default class Circles extends Component {
if (!columns[colIndex].isSeriesHidden) {
const rawValue = row[colIndex]
const valueNumber = Number(rawValue)
const value = !Number.isNaN(valueNumber) ? valueNumber : 0
const value = !isNaN(valueNumber) ? valueNumber : 0

const xLabel = row[stringColumnIndex]
const yLabel = legendLabels[i].label
Expand Down
2 changes: 1 addition & 1 deletion src/components/Charts/Squares/Squares.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default class Squares extends Component {
if (!columns[colIndex].isSeriesHidden) {
const rawValue = row[colIndex]
const valueNumber = Number(rawValue)
const value = !Number.isNaN(valueNumber) ? valueNumber : 0
const value = !isNaN(valueNumber) ? valueNumber : 0

const xLabel = row[stringColumnIndex]
const yLabel = legendLabels[i].label
Expand Down
2 changes: 1 addition & 1 deletion src/components/Charts/StackedBars/StackedBars.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class StackedColumns extends Component {
if (!columns[colIndex].isSeriesHidden) {
const rawValue = d[colIndex]
const valueNumber = Number(rawValue)
const value = !Number.isNaN(valueNumber) ? valueNumber : 0
const value = !isNaN(valueNumber) ? valueNumber : 0

if (!value) {
return null
Expand Down
2 changes: 1 addition & 1 deletion src/components/Charts/StackedColumns/StackedColumns.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class StackedColumns extends Component {
if (!columns[colIndex].isSeriesHidden) {
const rawValue = d[colIndex]
const valueNumber = Number(rawValue)
const value = !Number.isNaN(valueNumber) ? valueNumber : 0
const value = !isNaN(valueNumber) ? valueNumber : 0

if (!value) {
return null
Expand Down
4 changes: 2 additions & 2 deletions src/components/Charts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ export const getMaxValueFromKeyValueObj = (obj) => {
maxValue = obj[Object.keys(obj)[0]]
} else if (size > 1) {
const numberValues = [...Object.values(obj)].filter((value) => {
return !Number.isNaN(Number(value))
return !isNaN(Number(value))
})
maxValue = Math.max(...numberValues)
}
Expand All @@ -350,7 +350,7 @@ export const getMinValueFromKeyValueObj = (obj) => {
minValue = obj[Object.keys(obj)[0]]
} else if (size > 1) {
const numberValues = [...Object.values(obj)].filter((value) => {
return !Number.isNaN(Number(value))
return !isNaN(Number(value))
})
minValue = Math.min(...numberValues)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dashboard/DashboardTile/DashboardTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ export class DashboardTile extends React.Component {
percentString.substring(0, percentString.length - 1)
)

if (!Number.isNaN(percentNumber)) {
if (!isNaN(percentNumber)) {
this.debouncedSetParamsForTile({
secondDisplayPercentage: percentNumber,
})
Expand Down
4 changes: 2 additions & 2 deletions src/components/Notifications/Rule/Rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export default class Rule extends React.Component {
}

isNumerical = (num) => {
return !Number.isNaN(Number(num))
return !isNaN(Number(num))
}

isComplete = () => {
Expand Down Expand Up @@ -232,7 +232,7 @@ export default class Rule extends React.Component {
})
} else if (
!this.state.input2Value ||
!Number.isNaN(Number(this.state.input2Value))
!isNaN(Number(this.state.input2Value))
) {
this.setState({
isSecondTermValid: true,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Notifications/RuleSimple/RuleSimple.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default class RuleSimple extends React.Component {

// If just one word, strip everything but numbers
const strippedSymbolsStr = parseNum(num)
return !Number.isNaN(Number(strippedSymbolsStr))
return !isNaN(Number(strippedSymbolsStr))
}

isComplete = () => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/QueryOutput/QueryOutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,8 @@ export class QueryOutput extends React.Component {
!tableConfig ||
!tableConfig.numberColumnIndices ||
!tableConfig.stringColumnIndices ||
Number.isNaN(Number(tableConfig.numberColumnIndex)) ||
Number.isNaN(Number(tableConfig.stringColumnIndex))
isNaN(Number(tableConfig.numberColumnIndex)) ||
isNaN(Number(tableConfig.stringColumnIndex))
) {
return false
}
Expand Down
11 changes: 6 additions & 5 deletions src/components/Steps/Steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class Steps extends React.Component {
console.error(new Error('No steps were provided'))
} else if (
this.props.initialActiveStep != null &&
!Number.isNaN(this.props.initialActiveStep) &&
!isNaN(this.props.initialActiveStep) &&
!_get(this.props.steps, `${this.props.initialActiveStep}`)
) {
console.error(new Error('Initial active step provided is invalid'))
Expand All @@ -49,7 +49,7 @@ export default class Steps extends React.Component {
}

nextStep = () => {
const nextStep = Number.isNaN(this.state.activeStep)
const nextStep = isNaN(this.state.activeStep)
? 0
: this.state.activeStep + 1
this.onStepTitleClick(nextStep)
Expand Down Expand Up @@ -109,9 +109,10 @@ export default class Steps extends React.Component {
// be dynamically adjusted when the content changes
clearTimeout(this.autoHideTimeout)
this.autoHideTimeout = setTimeout(() => {
const activeContentContainerAfterTransition = document.querySelector(
`#react-autoql-step-content-${this.COMPONENT_KEY}-${i}`
)
const activeContentContainerAfterTransition =
document.querySelector(
`#react-autoql-step-content-${this.COMPONENT_KEY}-${i}`
)
if (activeContentContainerAfterTransition) {
activeContentContainerAfterTransition.style.height = 'auto'
}
Expand Down
4 changes: 2 additions & 2 deletions src/js/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const formatEpochDate = (value, col = {}, config = {}) => {
const title = col.title
let date = dayjs.unix(value).utc().format(dayMonthYear)

if (Number.isNaN(Number(value))) {
if (isNaN(Number(value))) {
// Not an epoch time. Try converting using dayjs
if (title && title.toLowerCase().includes('year')) {
date = dayjs(value).format(year)
Expand Down Expand Up @@ -982,7 +982,7 @@ export const dateSortFn = (a, b) => {
let bDate = Number(b)

// If one is not a number, use dayjs to format
if (Number.isNaN(aDate) || Number.isNaN(bDate)) {
if (isNaN(aDate) || isNaN(bDate)) {
aDate = dayjs(a).unix()
bDate = dayjs(b).unix()
}
Expand Down

0 comments on commit 01c6dc0

Please sign in to comment.