import * as originalFaker from "faker" ; /**
 * Extension of faker.js implementing additional data generation methods.
 */ class CustomFaker { param baseFaker constructor ( private baseFaker ) { baseFaker . locale = "en_IND" ; Object . assign ( this , baseFaker ) ; } param minAge param maxAge public dateOfBirth ( minAge , maxAge ) { const currentYear = new Date ( ) . getFullYear ( ) ; const latest = new Date ( ) ; latest . setFullYear ( currentYear - minAge ) ; const earliest = new Date ( ) ; earliest . setFullYear ( currentYear - maxAge ) ; return this . baseFaker . date . between ( earliest , latest ) ; } param date getEarlierDateOrToday ( date ) { const today = new Date ( ) ; if ( ! date || date > today ) { return today ; } else { return date ; } } } /**
 * Typing for faker including extended functionality.
 */ export type Faker = typeof originalFaker & CustomFaker ; originalFaker . seed ( 1 ) ; /**
 * (Extended) faker module
 */ export const faker = new CustomFaker ( originalFaker ) as Faker ;