Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/samualtnorman/predicates. A library of predicate functions and builders intended to be used with Ty
Something went wrong. Try again.
12345678import type { Key } from "@samual/lib"import type { Predicate, PredicateType } from "."import { isRecord } from "./isRecord"
export const ObjectSchema = <T extends Record<Key, Predicate<any>>>(schema: T) => (value: unknown): value is { [K in keyof T]: PredicateType<T[K]> } => isRecord(value) && Object.getOwnPropertyNames(schema).every((name: Key) => schema[name]!(value[name]))