"use strict"; const ValidationError = require("@validatem/error"); const isNumberObject = require("./is-number-object"); // FIXME: Document that NaN is not permitted but Infinity is module.exports = function (value) { if (!isNumberObject(value)) { throw new ValidationError("Must be a number", { code: "validatem.is-number.number" }); } else if (Number.isNaN(value)) { throw new ValidationError(`Must be a number (must not be NaN)`, { code: "validatem.is-number.nan" }); } };