acp-sdk
Version:
Agent Communication Protocol SDK
17 lines (15 loc) • 467 B
JavaScript
import * as z from 'zod';
function createSchemaTypePredicate(schema) {
return (data) => {
return schema.safeParse(data).success;
};
}
const nullishObject = (schema) => {
const nullishShape = Object.fromEntries(
Object.entries(schema.shape).map(([key, schema2]) => [key, schema2.nullish()])
);
return z.object(nullishShape);
};
export { createSchemaTypePredicate, nullishObject };
//# sourceMappingURL=utils.js.map
//# sourceMappingURL=utils.js.map