mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 05:32:09 +03:00
14 lines
421 B
TypeScript
14 lines
421 B
TypeScript
// Loaded from https://deno.land/x/validasaur/src/rules/not_in.ts
|
|
|
|
|
|
import type { Validity, Rule, PrimitiveTypes } from "../types.ts";
|
|
import { invalid } from "../utils.ts";
|
|
|
|
export function notIn(disallowedValues: PrimitiveTypes[]): Rule {
|
|
return function notInRule(value: any): Validity {
|
|
return disallowedValues.indexOf(value) > -1
|
|
? invalid("notIn", { value, disallowedValues })
|
|
: undefined;
|
|
};
|
|
}
|