@httpc/kit
Version:
httpc toolbox for building function-based API with minimal code and end-to-end type safety
15 lines (14 loc) • 430 B
JavaScript
export function isClass(func) {
return typeof func === "function" && func.prototype && !Object.getOwnPropertyDescriptor(func, "prototype")?.writable || false;
}
export function OptionalSchema(schema) {
return new Optional(schema);
}
class Optional {
constructor(schema) {
this.schema = schema;
}
}
export function isOptionalSchema(schema) {
return schema && schema instanceof Optional;
}