swc/crates/swc_bundler/tests/.cache/deno/f6c4ff998b8d311c0d580794f95348755cebcdc7.ts
2021-11-09 20:42:49 +09:00

14 lines
400 B
TypeScript

// 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 });
}
};
}