Skip to content

Commit

Permalink
se Number.isNaN for more accurate checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Baalmart committed Jan 6, 2025
1 parent ee92943 commit 2c91f95
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/device-registry/routes/v2/forecasts.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ const { oneOf } = require("express-validator");
const validatePagination = (req, res, next) => {
let limit = parseInt(req.query.limit, 10);
const skip = parseInt(req.query.skip, 10);
if (isNaN(limit) || limit < 1) {
if (Number.isNaN(limit) || limit < 1) {
limit = 1000;
}
if (limit > 2000) {
limit = 2000;
}
if (isNaN(skip) || skip < 0) {
if (Number.isNaN(skip) || skip < 0) {
req.query.skip = 0;
}
req.query.limit = limit;
Expand Down

0 comments on commit 2c91f95

Please sign in to comment.