mocker-data-generator
Version:
A simplified way to generate mock data, builds using a simple schema and with the FakerJs
23 lines (22 loc) • 738 B
TypeScript
import { Schema } from './Schema';
import { CustomGeneratorRun, Generators } from './types';
export type PromiseCb = Promise<any> | void;
export type IDB = {
[key: string]: any[];
};
export declare class Mocker {
schemas: Schema[];
DB: IDB;
options: {};
generators: Generators;
constructor(options?: {});
seed(name: string, data: any[]): Mocker;
addGenerator(name: string, library: any, run?: CustomGeneratorRun): Mocker;
schema(name: string, schema: {}, options?: {}): Mocker;
reset(): Mocker;
restart(): Mocker;
private _buildSync;
buildSync(): IDB;
build(cb?: (error: Error | null, _?: any) => void): Promise<any>;
build(cb?: (error: Error | null, _?: any) => void): void;
}