From 26611f5ed92cdeabee91f90e34be2f0998d5196c Mon Sep 17 00:00:00 2001 From: Nicola Date: Sat, 9 Jul 2022 15:55:13 -0300 Subject: [PATCH 1/2] Update TS types definitions --- fakerator.d.ts | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/fakerator.d.ts b/fakerator.d.ts index 5e35995..c2710fa 100644 --- a/fakerator.d.ts +++ b/fakerator.d.ts @@ -31,7 +31,6 @@ declare module 'fakerator' { Sports = 'sports', Technics = 'technics', Transport = 'transport', - Technics = 'flickr', ColorImage = 'color', GrayImage = 'gray' } @@ -104,7 +103,7 @@ declare module 'fakerator' { * @param precision Can generate floating number if you define this parameter. Note: Do not use 0 * @returns number */ - number(min: number, max: number, precision: number = 1): number; + number(min: number, max: number, precision: number): number; /** @@ -120,7 +119,7 @@ declare module 'fakerator' { * @param likelyhood Returns true if selected random value between 0 and 100 below this parameter. * @returns boolean */ - boolean(likelyhood: number = 50): boolean; + boolean(likelyhood: number): boolean; /** @@ -142,7 +141,7 @@ declare module 'fakerator' { * @param length Length of the generated string * @returns string */ - hex(length: number = 1): string; + hex(length: number): string; /** * Just one letter. @@ -466,16 +465,16 @@ declare module 'fakerator' { post(): Post; } class Fakerator { - constructor(localeID: string = 'default'); + constructor(localeID: string); - seed(newSeed: string = 'default'); + seed(newSeed: string); capitalize(textWillBeCapitalized: string): string; slugify(textWillBeSlugified: string): string; replaceSymbols(format: string): string; - replaceSymbols(format: string, numberSymbol: string = "#", alphaSymbol: string = "\\?"): string; + replaceSymbols(format: string, numberSymbol: string, alphaSymbol: string): string; shuffle(textWillBeShuffled: string): string; shuffle(arrayWillBeShuffled: Array): Array; @@ -483,32 +482,33 @@ declare module 'fakerator' { populate(format: string, ...args: Array): string; times(functionWillRepeat: Function, nTimes: number, ...args: Array): Array; - times(functionWillRepeat: Function, options: ITimesOptions, ...args: Array): Array; + times(functionWillRepeat: Function, options: TimesOptions, ...args: Array): Array; utimes(functionWillRepeat: Function, nTimes: number, ...args: Array): Array; - utimes(functionWillRepeat: Function, options: ITimesOptions, ...args: Array): Array; + utimes(functionWillRepeat: Function, options: TimesOptions, ...args: Array): Array; generate(functionWillBeUsedForGeneration: Function, ...args: Array): string; - public random = new FakeratorRandom(); + public random: FakeratorRandom; - public names = new FakeratorNames(); + public names: FakeratorNames; - public address = new FakeratorAddress(); + public address: FakeratorAddress; - public phone = new FakeratorPhone(); + public phone: FakeratorPhone; - public company = new FakeratorCompany(); + public company: FakeratorCompany; - public internet = new FakeratorInternet(); + public internet: FakeratorInternet; - public lorem = new FakeratorLorem(); + public lorem: FakeratorLorem; - public date = new FakeratorDate(); + public date: FakeratorDate; - public misc = new FakeratorMisc(); + public misc: FakeratorMisc; - public entity = new FakeratorEntity(); + public entity: FakeratorEntity; } - export default (localeID = 'default') => new Fakerator(localeID); + const fn: (localeID: string) => Fakerator; + export default fn; } From 8ba54a3f7349d69e45d0c4f76b5b049d2054cc86 Mon Sep 17 00:00:00 2001 From: Nicola Date: Sun, 10 Jul 2022 15:34:41 -0300 Subject: [PATCH 2/2] Update default values --- fakerator.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fakerator.d.ts b/fakerator.d.ts index c2710fa..efa1e21 100644 --- a/fakerator.d.ts +++ b/fakerator.d.ts @@ -103,7 +103,7 @@ declare module 'fakerator' { * @param precision Can generate floating number if you define this parameter. Note: Do not use 0 * @returns number */ - number(min: number, max: number, precision: number): number; + number(min: number, max: number, precision?: number): number; /** @@ -119,7 +119,7 @@ declare module 'fakerator' { * @param likelyhood Returns true if selected random value between 0 and 100 below this parameter. * @returns boolean */ - boolean(likelyhood: number): boolean; + boolean(likelyhood?: number): boolean; /** @@ -141,7 +141,7 @@ declare module 'fakerator' { * @param length Length of the generated string * @returns string */ - hex(length: number): string; + hex(length?: number): string; /** * Just one letter. @@ -465,16 +465,16 @@ declare module 'fakerator' { post(): Post; } class Fakerator { - constructor(localeID: string); + constructor(localeID?: string); - seed(newSeed: string); + seed(newSeed?: string); capitalize(textWillBeCapitalized: string): string; slugify(textWillBeSlugified: string): string; replaceSymbols(format: string): string; - replaceSymbols(format: string, numberSymbol: string, alphaSymbol: string): string; + replaceSymbols(format: string, numberSymbol?: string, alphaSymbol?: string): string; shuffle(textWillBeShuffled: string): string; shuffle(arrayWillBeShuffled: Array): Array; @@ -509,6 +509,6 @@ declare module 'fakerator' { public entity: FakeratorEntity; } - const fn: (localeID: string) => Fakerator; + const fn: (localeID?: string) => Fakerator; export default fn; }