You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
380 B
JavaScript
15 lines
380 B
JavaScript
"use strict";
|
|
|
|
const isNegativeZero = require("is-negative-zero");
|
|
const isNumber = require("@validatem/is-number");
|
|
const ValidationError = require("@validatem/error");
|
|
|
|
module.exports = [
|
|
isNumber,
|
|
function isPositive(value) {
|
|
if (value < 0 || isNegativeZero(value)) {
|
|
return new ValidationError("Must be a positive number", { code: "validatem.is-positive" });
|
|
}
|
|
}
|
|
];
|