mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 06:36:08 +03:00
14 lines
391 B
TypeScript
14 lines
391 B
TypeScript
|
// Loaded from https://deno.land/x/validasaur/src/rules/min_number.ts
|
||
|
|
||
|
|
||
|
import type { Validity, Rule } from "../types.ts";
|
||
|
import { invalid } from "../utils.ts";
|
||
|
|
||
|
export function minNumber(minValue: number): Rule {
|
||
|
return function minRule(value: any): Validity {
|
||
|
if (typeof value !== "number" || value < minValue) {
|
||
|
return invalid("minNumber", { value, minValue });
|
||
|
}
|
||
|
};
|
||
|
}
|