mirror of
https://github.com/swc-project/swc.git
synced 2024-12-22 21:21:31 +03:00
14 lines
451 B
TypeScript
14 lines
451 B
TypeScript
// Loaded from https://deno.land/x/validasaur/src/rules/number_between.ts
|
|
|
|
|
|
import type { Validity, Rule } from "../types.ts";
|
|
import { invalid } from "../utils.ts";
|
|
|
|
export function numberBetween(minValue: number, maxValue: number): Rule {
|
|
return function maxRule(value: any): Validity {
|
|
if (typeof value !== "number" || value < minValue || value > maxValue) {
|
|
return invalid("numberBetween", { value, maxValue, minValue });
|
|
}
|
|
};
|
|
}
|