UNPKG

@italia-tools/faker

Version:

Italian-specific fake data generator based on Faker.js

33 lines (32 loc) 896 B
import type { Faker } from "@faker-js/faker"; import { Gender } from "../types/types"; import type { ItalianCity } from "../types/city"; import { type Observable } from 'rxjs'; export interface FiscalCodeOptions { firstName?: string; lastName?: string; gender?: Gender; birthDate?: Date; birthPlace?: BirthPlace; } export interface CountryDto { name: string; code: string; } export type BirthPlace = { type: 'italian'; city: ItalianCity; } | { type: 'foreign'; country: CountryDto; }; export declare class FiscalCodeModule { private readonly faker; private readonly placesModule; private readonly firstNameModule; private readonly lastNameModule; constructor(faker: Faker); generate$(options?: FiscalCodeOptions): Observable<string>; generate(options?: FiscalCodeOptions): Promise<string>; private validateBirthPlace; }