swc/crates/swc_bundler/tests/.cache/deno/f6c4ff998b8d311c0d580794f95348755cebcdc7.ts

14 lines
400 B
TypeScript
Raw Normal View History

// Loaded from https://deno.land/x/validasaur/src/rules/is_in.ts
import type { Validity, Rule, PrimitiveTypes } from "../types.ts";
import { invalid } from "../utils.ts";
export function isIn(allowedValues: PrimitiveTypes[]): Rule {
return function isInRule(value: any): Validity {
if (allowedValues.indexOf(value) < 0) {
return invalid("isIn", { value, allowedValues });
}
};
}