import type { ValueMatcherPrimitive } from "./types"; import { isValueMatcherObject } from "./matcher"; export function isValueMatcherPrimitive(value: unknown): value is ValueMatcherPrimitive { return value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean"; } export function normalizeExpectMatchers(expect: Record, keys: string[]): void { for (const key of keys) { if (key in expect) { expect[key] = normalizeValueMatcher(expect[key]); } } } export function normalizeValueMatcher(value: unknown): unknown { if (value === undefined) return undefined; if (isValueMatcherObject(value)) return value; if (isValueMatcherPrimitive(value)) return { equals: value }; return value; }