mirror of
https://github.com/swc-project/swc.git
synced 2024-12-29 16:42:28 +03:00
12 lines
315 B
TypeScript
12 lines
315 B
TypeScript
// Loaded from https://deno.land/x/validasaur/src/rules/required.ts
|
|
|
|
|
|
import type { Validity } from "../types.ts";
|
|
import { invalid, isOptionalValue } from "../utils.ts";
|
|
|
|
export function required(value: any): Validity {
|
|
return isOptionalValue(value)
|
|
? invalid("required", { value }, true)
|
|
: undefined;
|
|
}
|