mimic-data 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,225 @@
1
+ type Gender = 'male' | 'female';
2
+ type MetricSystem = 'metric' | 'imperial';
3
+ interface PersonData {
4
+ firstName: string;
5
+ lastName: string;
6
+ fullName: string;
7
+ gender: Gender;
8
+ age: number;
9
+ dateOfBirth: Date;
10
+ }
11
+ interface AddressData {
12
+ street: string;
13
+ city: string;
14
+ state: string;
15
+ zipCode: string;
16
+ fullAddress: string;
17
+ }
18
+ interface PhysicalData {
19
+ height: number;
20
+ weight: number;
21
+ heightUnit: 'cm' | 'ft';
22
+ weightUnit: 'kg' | 'lb';
23
+ }
24
+ interface WorkData {
25
+ jobTitle: string;
26
+ department: string;
27
+ }
28
+ interface AgeRange {
29
+ min?: number;
30
+ max?: number;
31
+ }
32
+ interface LocaleData {
33
+ firstNamesMale: string[];
34
+ firstNamesFemale: string[];
35
+ lastNames: string[];
36
+ streets: string[];
37
+ cities: string[];
38
+ states: string[];
39
+ zipCodePattern: string;
40
+ jobTitles: string[];
41
+ departments: string[];
42
+ metricSystem: MetricSystem;
43
+ }
44
+ interface LocaleDefinition extends LocaleData {
45
+ formatFullName(firstName: string, lastName: string): string;
46
+ formatAddress(street: string, city: string, state: string, zipCode: string): string;
47
+ generateZipCode(): string;
48
+ }
49
+
50
+ declare class Mimic {
51
+ private locale;
52
+ constructor(locale: LocaleDefinition);
53
+ /**
54
+ * Update the locale
55
+ */
56
+ setLocale(locale: LocaleDefinition): void;
57
+ /**
58
+ * Identity generator
59
+ */
60
+ get identity(): {
61
+ firstName: (gender?: Gender) => string;
62
+ lastName: () => string;
63
+ fullName: (gender?: Gender) => string;
64
+ gender: () => Gender;
65
+ age: (range?: AgeRange) => number;
66
+ dateOfBirth: (range?: AgeRange) => Date;
67
+ person: (gender?: Gender, ageRange?: AgeRange) => PersonData;
68
+ };
69
+ /**
70
+ * Location generator
71
+ */
72
+ get location(): {
73
+ street: () => string;
74
+ city: () => string;
75
+ state: () => string;
76
+ zipCode: () => string;
77
+ fullAddress: () => string;
78
+ address: () => AddressData;
79
+ };
80
+ /**
81
+ * Physical data generator
82
+ */
83
+ get physical(): {
84
+ height: () => PhysicalData;
85
+ weight: () => PhysicalData;
86
+ data: () => PhysicalData;
87
+ };
88
+ /**
89
+ * Work data generator
90
+ */
91
+ get work(): {
92
+ jobTitle: () => string;
93
+ department: () => string;
94
+ data: () => WorkData;
95
+ };
96
+ }
97
+
98
+ /**
99
+ * Random utility functions using native Math.random()
100
+ */
101
+ declare class Random {
102
+ /**
103
+ * Get random element from array
104
+ */
105
+ static pick<T>(array: T[]): T;
106
+ /**
107
+ * Get random integer between min and max (inclusive)
108
+ */
109
+ static int(min: number, max: number): number;
110
+ /**
111
+ * Get random float between min and max
112
+ */
113
+ static float(min: number, max: number, decimals?: number): number;
114
+ /**
115
+ * Get random boolean
116
+ */
117
+ static boolean(): boolean;
118
+ /**
119
+ * Shuffle array (Fisher-Yates algorithm)
120
+ */
121
+ static shuffle<T>(array: T[]): T[];
122
+ }
123
+
124
+ /**
125
+ * Locale Registry untuk manajemen locale yang efisien
126
+ * Mendukung lazy loading dan auto-registration
127
+ */
128
+ declare class LocaleRegistry {
129
+ private locales;
130
+ private aliases;
131
+ /**
132
+ * Register locale baru
133
+ * @param code - Kode locale utama (contoh: 'en_US')
134
+ * @param definition - Definisi locale
135
+ * @param aliasesArray - Array alias untuk locale ini (contoh: ['en', 'us'])
136
+ */
137
+ register(code: string, definition: LocaleDefinition, aliasesArray?: string[]): void;
138
+ /**
139
+ * Get locale definition
140
+ * @param code - Kode locale atau alias
141
+ * @returns LocaleDefinition atau undefined
142
+ */
143
+ get(code: string): LocaleDefinition | undefined;
144
+ /**
145
+ * Check apakah locale tersedia
146
+ */
147
+ has(code: string): boolean;
148
+ /**
149
+ * Get semua locale yang tersedia
150
+ */
151
+ getAvailableLocales(): string[];
152
+ /**
153
+ * Get semua aliases yang tersedia
154
+ */
155
+ getAvailableAliases(): string[];
156
+ /**
157
+ * Get semua kode (locale + aliases)
158
+ */
159
+ getAllCodes(): string[];
160
+ }
161
+ declare const localeRegistry: LocaleRegistry;
162
+
163
+ /**
164
+ * Factory function to create Mimic instance with specified locale
165
+ */
166
+ declare function createMimic(locale?: string): Mimic;
167
+ /**
168
+ * Get available main locale codes
169
+ */
170
+ declare function getAvailableLocales(): string[];
171
+ /**
172
+ * Get all codes (locales + aliases)
173
+ */
174
+ declare function getAllLocaleCodes(): string[];
175
+ /**
176
+ * Export all locale definitions for advanced usage
177
+ */
178
+ declare const locales: {
179
+ en_US: LocaleDefinition;
180
+ ja_JP: LocaleDefinition;
181
+ id_ID: LocaleDefinition;
182
+ de_DE: LocaleDefinition;
183
+ fr_FR: LocaleDefinition;
184
+ pt_BR: LocaleDefinition;
185
+ ko_KR: LocaleDefinition;
186
+ en_AU: LocaleDefinition;
187
+ zh_CN: LocaleDefinition;
188
+ en_IN: LocaleDefinition;
189
+ es_MX: LocaleDefinition;
190
+ it_IT: LocaleDefinition;
191
+ es_ES: LocaleDefinition;
192
+ nl_NL: LocaleDefinition;
193
+ en_CA: LocaleDefinition;
194
+ en_GB: LocaleDefinition;
195
+ ru_RU: LocaleDefinition;
196
+ pl_PL: LocaleDefinition;
197
+ tr_TR: LocaleDefinition;
198
+ sv_SE: LocaleDefinition;
199
+ nb_NO: LocaleDefinition;
200
+ da_DK: LocaleDefinition;
201
+ fi_FI: LocaleDefinition;
202
+ es_AR: LocaleDefinition;
203
+ es_CL: LocaleDefinition;
204
+ th_TH: LocaleDefinition;
205
+ vi_VN: LocaleDefinition;
206
+ ms_MY: LocaleDefinition;
207
+ en_SG: LocaleDefinition;
208
+ en_PH: LocaleDefinition;
209
+ en_NZ: LocaleDefinition;
210
+ en_ZA: LocaleDefinition;
211
+ pt_PT: LocaleDefinition;
212
+ el_GR: LocaleDefinition;
213
+ cs_CZ: LocaleDefinition;
214
+ de_AT: LocaleDefinition;
215
+ de_CH: LocaleDefinition;
216
+ nl_BE: LocaleDefinition;
217
+ hu_HU: LocaleDefinition;
218
+ ro_RO: LocaleDefinition;
219
+ ar_AE: LocaleDefinition;
220
+ ar_SA: LocaleDefinition;
221
+ ar_EG: LocaleDefinition;
222
+ he_IL: LocaleDefinition;
223
+ };
224
+
225
+ export { type AddressData, type AgeRange, type Gender, type LocaleData, type LocaleDefinition, type MetricSystem, Mimic, type PersonData, type PhysicalData, Random, type WorkData, createMimic, createMimic as default, getAllLocaleCodes, getAvailableLocales, localeRegistry, locales };