desi-mongoose
Version:
A fun and intuitive MongoDB ODM for Node.js with a Hinglish twist
28 lines (27 loc) • 705 B
TypeScript
interface SchemaField {
type: any;
required?: boolean;
default?: any;
validate?: (value: any) => boolean;
}
interface SchemaDefinition {
[key: string]: SchemaField;
}
export declare class DesiSchema {
private fields;
constructor(fields: SchemaDefinition);
validate(data: any): boolean;
static String(options?: Partial<SchemaField>): {
type: any;
required: boolean;
default?: any;
validate?: ((value: any) => boolean) | undefined;
};
static Number(options?: Partial<SchemaField>): {
type: any;
required: boolean;
default?: any;
validate?: ((value: any) => boolean) | undefined;
};
}
export {};