jsonv-ts
Version:
JSON Schema builder and validator for TypeScript with static type inference, Hono middleware for OpenAPI generation and validation, and MCP server/client implementation. Lightweight, dependency-free, and built on Web Standards.
34 lines (33 loc) • 2.06 kB
TypeScript
import type { PropertyName, JSONSchemaDefinition } from "../types";
import { Schema, type ISchemaOptions } from "../schema/schema";
export declare function isNull(value: unknown): value is null;
export declare function isDefined(value: unknown): value is NonNullable<unknown>;
export declare function isObject(value: unknown): value is Record<string, unknown>;
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
export declare function isString(value: unknown): value is string;
export declare function isNumber(value: unknown): value is number;
export declare function isInteger(value: unknown): value is number;
export declare function isBoolean(value: unknown): value is boolean;
export declare function isArray(value: unknown): value is unknown[];
export declare function isValidPropertyName(value: unknown): value is PropertyName;
export declare function isNonBooleanRawSchema(schema: unknown): schema is Exclude<JSONSchemaDefinition, boolean>;
export declare function isTypeSchema(schema: unknown): schema is {
type: string | string[];
};
export declare function isSchema(schema: unknown): schema is Schema & ISchemaOptions;
export declare function isBooleanSchema(schema: unknown): schema is Schema & {
toJSON: () => boolean;
};
export declare function matchesPattern(pattern: string, value: string): boolean;
export declare function invariant(condition: unknown, message: string, value?: unknown): asserts condition;
export declare function normalize(value: unknown): unknown;
export declare function pickKeys<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
export declare function safeStructuredClone<T>(value: T): T;
/**
* Lodash's merge implementation caused issues in Next.js environments
* From: https://thescottyjam.github.io/snap.js/#!/nolodash/merge
* NOTE: This mutates `object`. It also may mutate anything that gets attached to `object` during the merge.
* @param object
* @param sources
*/
export declare function mergeObject(object: any, ...sources: any[]): any;