@samet-it/be-base-common 1.0.1
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.
- package/LICENSE +24 -0
- package/README.md +106 -0
- package/dist/assets/.gitkeep +0 -0
- package/dist/config/base-common.config.d.ts +2 -0
- package/dist/config/base-common.config.js +9 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +18 -0
- package/dist/config/index.types.d.ts +12 -0
- package/dist/config/index.types.js +2 -0
- package/dist/error/base.exception.d.ts +7 -0
- package/dist/error/base.exception.js +11 -0
- package/dist/error/error.handler.d.ts +2 -0
- package/dist/error/error.handler.js +217 -0
- package/dist/error/index.d.ts +8 -0
- package/dist/error/index.js +24 -0
- package/dist/error/index.types.d.ts +31 -0
- package/dist/error/index.types.js +2 -0
- package/dist/error/initialization.exception.d.ts +4 -0
- package/dist/error/initialization.exception.js +11 -0
- package/dist/error/page-not-found.exception.d.ts +4 -0
- package/dist/error/page-not-found.exception.js +10 -0
- package/dist/error/record-duplicated.exception.d.ts +4 -0
- package/dist/error/record-duplicated.exception.js +18 -0
- package/dist/error/record-not-found.exception.d.ts +4 -0
- package/dist/error/record-not-found.exception.js +13 -0
- package/dist/error/validation.exception.d.ts +4 -0
- package/dist/error/validation.exception.js +23 -0
- package/dist/exit/exit-handler.impl.d.ts +2 -0
- package/dist/exit/exit-handler.impl.js +13 -0
- package/dist/exit/index.d.ts +2 -0
- package/dist/exit/index.js +18 -0
- package/dist/exit/index.types.d.ts +4 -0
- package/dist/exit/index.types.js +2 -0
- package/dist/generator/generator.d.ts +2 -0
- package/dist/generator/generator.js +417 -0
- package/dist/generator/index.d.ts +2 -0
- package/dist/generator/index.js +18 -0
- package/dist/generator/index.types.d.ts +616 -0
- package/dist/generator/index.types.js +2 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +21 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +17 -0
- package/dist/shared/index.types.d.ts +11 -0
- package/dist/shared/index.types.js +2 -0
- package/package.json +70 -0
|
@@ -0,0 +1,616 @@
|
|
|
1
|
+
export type DateType = 'year' | 'y' | 'month' | 'm' | 'day' | 'd';
|
|
2
|
+
export type TimeType = 'hour' | 'h' | 'minute' | 'i' | 'second' | 's';
|
|
3
|
+
export type DateTimeType = DateType | TimeType;
|
|
4
|
+
export type PastFuture = 'past' | 'future' | 'both';
|
|
5
|
+
export type GeneratorItemLambda<T> = () => T;
|
|
6
|
+
export interface GeneratorLike {
|
|
7
|
+
/**
|
|
8
|
+
* Enrich instance, it should be called in the constructor
|
|
9
|
+
*
|
|
10
|
+
* @param {object} instance - `this` instance
|
|
11
|
+
* @param {object} given - incoming data
|
|
12
|
+
* */
|
|
13
|
+
buildConstructor<T extends {} = {}>(instance: T, given: Partial<T>): void;
|
|
14
|
+
/**
|
|
15
|
+
* Loops n times
|
|
16
|
+
*
|
|
17
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
18
|
+
* @param {function} callback
|
|
19
|
+
* */
|
|
20
|
+
forLength<T>(size: number | true, callback: GeneratorItemLambda<T>): Array<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Generates a word
|
|
23
|
+
* */
|
|
24
|
+
word(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Generates a word with a specific length
|
|
27
|
+
*
|
|
28
|
+
* @param {number} length - text length
|
|
29
|
+
* */
|
|
30
|
+
word(length: number): string;
|
|
31
|
+
/**
|
|
32
|
+
* Generates a word with a specific length
|
|
33
|
+
*
|
|
34
|
+
* @param {number} length - text length
|
|
35
|
+
* @param {string} alphabet - text pattern to generate
|
|
36
|
+
* */
|
|
37
|
+
word(length: number, alphabet: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Generates a word
|
|
40
|
+
*
|
|
41
|
+
* @param {string} alphabet - text pattern to generate
|
|
42
|
+
* */
|
|
43
|
+
word(alphabet: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Generates a word array
|
|
46
|
+
*
|
|
47
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
48
|
+
* */
|
|
49
|
+
wordArray(size: number | true): Array<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Generates a word array with a specific length
|
|
52
|
+
*
|
|
53
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
54
|
+
* @param {number} length - text length
|
|
55
|
+
* */
|
|
56
|
+
wordArray(size: number | true, length: number): Array<string>;
|
|
57
|
+
/**
|
|
58
|
+
* Generates a word array with a specific length
|
|
59
|
+
*
|
|
60
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
61
|
+
* @param {number} length - text length
|
|
62
|
+
* @param {string} alphabet - text pattern to generate
|
|
63
|
+
* */
|
|
64
|
+
wordArray(size: number | true, length: number, alphabet: string): Array<string>;
|
|
65
|
+
/**
|
|
66
|
+
* Generates a word array
|
|
67
|
+
*
|
|
68
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
69
|
+
* @param {string} alphabet - text pattern to generate
|
|
70
|
+
* */
|
|
71
|
+
wordArray(size: number | true, alphabet: string): Array<string>;
|
|
72
|
+
/**
|
|
73
|
+
* Generates a numeric string
|
|
74
|
+
* */
|
|
75
|
+
numeric(): string;
|
|
76
|
+
/**
|
|
77
|
+
* Generates a numeric string with a specific length
|
|
78
|
+
*
|
|
79
|
+
* @param {number} length - text length
|
|
80
|
+
* */
|
|
81
|
+
numeric(length: number): string;
|
|
82
|
+
/**
|
|
83
|
+
* Generates a numeric string array
|
|
84
|
+
*
|
|
85
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
86
|
+
* */
|
|
87
|
+
numericArray(size: number | true): Array<string>;
|
|
88
|
+
/**
|
|
89
|
+
* Generates a numeric string array with a specific length
|
|
90
|
+
*
|
|
91
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
92
|
+
* @param {number} length - text length
|
|
93
|
+
* */
|
|
94
|
+
numericArray(size: number | true, length: number): Array<string>;
|
|
95
|
+
/**
|
|
96
|
+
* Generates a first upper case string
|
|
97
|
+
* */
|
|
98
|
+
firstUpper(): string;
|
|
99
|
+
/**
|
|
100
|
+
* Generates a first upper case with a specific length
|
|
101
|
+
*
|
|
102
|
+
* @param {number} length - text length
|
|
103
|
+
* */
|
|
104
|
+
firstUpper(length: number): string;
|
|
105
|
+
/**
|
|
106
|
+
* Generates a first upper case array
|
|
107
|
+
*
|
|
108
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
109
|
+
* */
|
|
110
|
+
firstUpperArray(size: number | true): Array<string>;
|
|
111
|
+
/**
|
|
112
|
+
* Generates a first upper case array with a specific length
|
|
113
|
+
*
|
|
114
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
115
|
+
* @param {number} length - text length
|
|
116
|
+
* */
|
|
117
|
+
firstUpperArray(size: number | true, length: number): Array<string>;
|
|
118
|
+
/**
|
|
119
|
+
* Generates an upper case string
|
|
120
|
+
* */
|
|
121
|
+
upper(): string;
|
|
122
|
+
/**
|
|
123
|
+
* Generates an upper case string with a specific length
|
|
124
|
+
*
|
|
125
|
+
* @param {number} length - text length
|
|
126
|
+
* */
|
|
127
|
+
upper(length: number): string;
|
|
128
|
+
/**
|
|
129
|
+
* Generates an upper case string array
|
|
130
|
+
*
|
|
131
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
132
|
+
* */
|
|
133
|
+
upperArray(size: number | true): Array<string>;
|
|
134
|
+
/**
|
|
135
|
+
* Generates an upper case string array with a specific length
|
|
136
|
+
*
|
|
137
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
138
|
+
* @param {number} length - text length
|
|
139
|
+
* */
|
|
140
|
+
upperArray(size: number | true, length: number): Array<string>;
|
|
141
|
+
/**
|
|
142
|
+
* Generates a lower case string
|
|
143
|
+
* */
|
|
144
|
+
lower(): string;
|
|
145
|
+
/**
|
|
146
|
+
* Generates a lower case string with a specific length
|
|
147
|
+
*
|
|
148
|
+
* @param {number} length - text length
|
|
149
|
+
* */
|
|
150
|
+
lower(length: number): string;
|
|
151
|
+
/**
|
|
152
|
+
* Generates a lower case string array
|
|
153
|
+
*
|
|
154
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
155
|
+
* */
|
|
156
|
+
lowerArray(size: number | true): Array<string>;
|
|
157
|
+
/**
|
|
158
|
+
* Generates a lower case string array with a specific length
|
|
159
|
+
*
|
|
160
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
161
|
+
* @param {number} length - text length
|
|
162
|
+
* */
|
|
163
|
+
lowerArray(size: number | true, length: number): Array<string>;
|
|
164
|
+
/**
|
|
165
|
+
* Generates a lorem ipsum
|
|
166
|
+
* */
|
|
167
|
+
loremIpsum(): string;
|
|
168
|
+
/**
|
|
169
|
+
* Generates a lorem ipsum with a specific word count
|
|
170
|
+
* @param {number} count - word count
|
|
171
|
+
* */
|
|
172
|
+
loremIpsum(count: number): string;
|
|
173
|
+
/**
|
|
174
|
+
* Generates a lorem ipsum array
|
|
175
|
+
*
|
|
176
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
177
|
+
* */
|
|
178
|
+
loremIpsumArray(size: number | true): Array<string>;
|
|
179
|
+
/**
|
|
180
|
+
* Generates a lorem ipsum array with a specific word count
|
|
181
|
+
*
|
|
182
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
183
|
+
* @param {number} count - word count
|
|
184
|
+
* */
|
|
185
|
+
loremIpsumArray(size: number | true, count: number): Array<string>;
|
|
186
|
+
/**
|
|
187
|
+
* Generates an integer
|
|
188
|
+
* */
|
|
189
|
+
integer(): number;
|
|
190
|
+
/**
|
|
191
|
+
* Generates an integer with max
|
|
192
|
+
*
|
|
193
|
+
* @param {number} max - max limit
|
|
194
|
+
* */
|
|
195
|
+
integer(max: number): number;
|
|
196
|
+
/**
|
|
197
|
+
* Generates an integer with min and max
|
|
198
|
+
*
|
|
199
|
+
* @param {number} min - min limit
|
|
200
|
+
* @param {number} max - max limit
|
|
201
|
+
* */
|
|
202
|
+
integer(min: number, max: number): number;
|
|
203
|
+
/**
|
|
204
|
+
* Generates an integer array
|
|
205
|
+
*
|
|
206
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
207
|
+
* */
|
|
208
|
+
integerArray(size: number | true): Array<number>;
|
|
209
|
+
/**
|
|
210
|
+
* Generates an integer array with max
|
|
211
|
+
*
|
|
212
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
213
|
+
* @param {number} max - max limit
|
|
214
|
+
* */
|
|
215
|
+
integerArray(size: number | true, max: number): Array<number>;
|
|
216
|
+
/**
|
|
217
|
+
* Generates an integer array with min and max
|
|
218
|
+
*
|
|
219
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
220
|
+
* @param {number} min - min limit
|
|
221
|
+
* @param {number} max - max limit
|
|
222
|
+
* */
|
|
223
|
+
integerArray(size: number | true, min: number, max: number): Array<number>;
|
|
224
|
+
/**
|
|
225
|
+
* Generates a double
|
|
226
|
+
* */
|
|
227
|
+
double(): number;
|
|
228
|
+
/**
|
|
229
|
+
* Generates a double with max
|
|
230
|
+
*
|
|
231
|
+
* @param {number} max - max limit
|
|
232
|
+
* */
|
|
233
|
+
double(max: number): number;
|
|
234
|
+
/**
|
|
235
|
+
* Generates a double with min and max
|
|
236
|
+
*
|
|
237
|
+
* @param {number} min - min limit
|
|
238
|
+
* @param {number} max - max limit
|
|
239
|
+
* */
|
|
240
|
+
double(min: number, max: number): number;
|
|
241
|
+
/**
|
|
242
|
+
* Generates a double array
|
|
243
|
+
*
|
|
244
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
245
|
+
* */
|
|
246
|
+
doubleArray(size: number | true): Array<number>;
|
|
247
|
+
/**
|
|
248
|
+
* Generates a double array with max
|
|
249
|
+
*
|
|
250
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
251
|
+
* @param {number} max - max limit
|
|
252
|
+
* */
|
|
253
|
+
doubleArray(size: number | true, max: number): Array<number>;
|
|
254
|
+
/**
|
|
255
|
+
* Generates a double array with min and max
|
|
256
|
+
*
|
|
257
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
258
|
+
* @param {number} min - min limit
|
|
259
|
+
* @param {number} max - max limit
|
|
260
|
+
* */
|
|
261
|
+
doubleArray(size: number | true, min: number, max: number): Array<number>;
|
|
262
|
+
/**
|
|
263
|
+
* Generates an uuid
|
|
264
|
+
* */
|
|
265
|
+
uuid(): string;
|
|
266
|
+
/**
|
|
267
|
+
* Generates an uuid array
|
|
268
|
+
*
|
|
269
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
270
|
+
* */
|
|
271
|
+
uuidArray(size: number | true): Array<string>;
|
|
272
|
+
/**
|
|
273
|
+
* Generates a boolean
|
|
274
|
+
* */
|
|
275
|
+
boolean(): boolean;
|
|
276
|
+
/**
|
|
277
|
+
* Generates a boolean array
|
|
278
|
+
*
|
|
279
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
280
|
+
* */
|
|
281
|
+
booleanArray(size: number | true): Array<boolean>;
|
|
282
|
+
/**
|
|
283
|
+
* Generates a timestamp
|
|
284
|
+
* */
|
|
285
|
+
timestamp(): number;
|
|
286
|
+
/**
|
|
287
|
+
* Generates a timestamp with type
|
|
288
|
+
*
|
|
289
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
290
|
+
* */
|
|
291
|
+
timestamp(type: DateTimeType): number;
|
|
292
|
+
/**
|
|
293
|
+
* Generates a timestamp with type and multiplier
|
|
294
|
+
*
|
|
295
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
296
|
+
* @param {number} multiplier - multiplier of part
|
|
297
|
+
* */
|
|
298
|
+
timestamp(type: DateTimeType, multiplier: number): number;
|
|
299
|
+
/**
|
|
300
|
+
* Generates a timestamp with type and multiplier and past-future option
|
|
301
|
+
*
|
|
302
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
303
|
+
* @param {number} multiplier - multiplier of part
|
|
304
|
+
* @param {PastFuture} pastFuture - past-future option for multiplier
|
|
305
|
+
* */
|
|
306
|
+
timestamp(type: DateTimeType, multiplier: number, pastFuture: PastFuture): number;
|
|
307
|
+
/**
|
|
308
|
+
* Generates a timestamp array
|
|
309
|
+
*
|
|
310
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
311
|
+
* */
|
|
312
|
+
timestampArray(size: number | true): Array<number>;
|
|
313
|
+
/**
|
|
314
|
+
* Generates a timestamp array with type
|
|
315
|
+
*
|
|
316
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
317
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
318
|
+
* */
|
|
319
|
+
timestampArray(size: number | true, type: DateTimeType): Array<number>;
|
|
320
|
+
/**
|
|
321
|
+
* Generates a timestamp array with type and multiplier
|
|
322
|
+
*
|
|
323
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
324
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
325
|
+
* @param {number} multiplier - multiplier of part
|
|
326
|
+
* */
|
|
327
|
+
timestampArray(size: number | true, type: DateTimeType, multiplier: number): Array<number>;
|
|
328
|
+
/**
|
|
329
|
+
* Generates a timestamp array with type and multiplier and past-future option
|
|
330
|
+
*
|
|
331
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
332
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
333
|
+
* @param {number} multiplier - multiplier of part
|
|
334
|
+
* @param {PastFuture} pastFuture - past-future option for multiplier
|
|
335
|
+
* */
|
|
336
|
+
timestampArray(size: number | true, type: DateTimeType, multiplier: number, pastFuture: PastFuture): Array<number>;
|
|
337
|
+
/**
|
|
338
|
+
* Generates a datetime
|
|
339
|
+
* */
|
|
340
|
+
datetime(): Date;
|
|
341
|
+
/**
|
|
342
|
+
* Generates a datetime with type
|
|
343
|
+
*
|
|
344
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
345
|
+
* */
|
|
346
|
+
datetime(type: DateTimeType): Date;
|
|
347
|
+
/**
|
|
348
|
+
* Generates a datetime with type and multiplier
|
|
349
|
+
*
|
|
350
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
351
|
+
* @param {number} multiplier - multiplier of part
|
|
352
|
+
* */
|
|
353
|
+
datetime(type: DateTimeType, multiplier: number): Date;
|
|
354
|
+
/**
|
|
355
|
+
* Generates a datetime with type and multiplier and past-future option
|
|
356
|
+
*
|
|
357
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
358
|
+
* @param {number} multiplier - multiplier of part
|
|
359
|
+
* @param {PastFuture} pastFuture - past-future option for multiplier
|
|
360
|
+
* */
|
|
361
|
+
datetime(type: DateTimeType, multiplier: number, pastFuture: PastFuture): Date;
|
|
362
|
+
/**
|
|
363
|
+
* Generates a datetime array
|
|
364
|
+
*
|
|
365
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
366
|
+
* */
|
|
367
|
+
datetimeArray(size: number | true): Array<Date>;
|
|
368
|
+
/**
|
|
369
|
+
* Generates a datetime array with type
|
|
370
|
+
*
|
|
371
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
372
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
373
|
+
* */
|
|
374
|
+
datetimeArray(size: number | true, type: DateTimeType): Array<Date>;
|
|
375
|
+
/**
|
|
376
|
+
* Generates a datetime array with type and multiplier
|
|
377
|
+
*
|
|
378
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
379
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
380
|
+
* @param {number} multiplier - multiplier of part
|
|
381
|
+
* */
|
|
382
|
+
datetimeArray(size: number | true, type: DateTimeType, multiplier: number): Array<Date>;
|
|
383
|
+
/**
|
|
384
|
+
* Generates a datetime array with type and multiplier and past-future option
|
|
385
|
+
*
|
|
386
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
387
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
388
|
+
* @param {number} multiplier - multiplier of part
|
|
389
|
+
* @param {PastFuture} pastFuture - past-future option for multiplier
|
|
390
|
+
* */
|
|
391
|
+
datetimeArray(size: number | true, type: DateTimeType, multiplier: number, pastFuture: PastFuture): Array<Date>;
|
|
392
|
+
/**
|
|
393
|
+
* Generates a datetime
|
|
394
|
+
* */
|
|
395
|
+
isoDate(): string;
|
|
396
|
+
/**
|
|
397
|
+
* Generates a datetime with type
|
|
398
|
+
*
|
|
399
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
400
|
+
* */
|
|
401
|
+
isoDate(type: DateTimeType): string;
|
|
402
|
+
/**
|
|
403
|
+
* Generates a datetime with type and multiplier
|
|
404
|
+
*
|
|
405
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
406
|
+
* @param {number} multiplier - multiplier of part
|
|
407
|
+
* */
|
|
408
|
+
isoDate(type: DateTimeType, multiplier: number): string;
|
|
409
|
+
/**
|
|
410
|
+
* Generates a datetime with type and multiplier and past-future option
|
|
411
|
+
*
|
|
412
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
413
|
+
* @param {number} multiplier - multiplier of part
|
|
414
|
+
* @param {PastFuture} pastFuture - past-future option for multiplier
|
|
415
|
+
* */
|
|
416
|
+
isoDate(type: DateTimeType, multiplier: number, pastFuture: PastFuture): string;
|
|
417
|
+
/**
|
|
418
|
+
* Generates a datetime array
|
|
419
|
+
*
|
|
420
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
421
|
+
* */
|
|
422
|
+
isoDateArray(size: number | true): Array<string>;
|
|
423
|
+
/**
|
|
424
|
+
* Generates a datetime array with type
|
|
425
|
+
*
|
|
426
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
427
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
428
|
+
* */
|
|
429
|
+
isoDateArray(size: number | true, type: DateTimeType): Array<string>;
|
|
430
|
+
/**
|
|
431
|
+
* Generates a datetime array with type and multiplier
|
|
432
|
+
*
|
|
433
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
434
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
435
|
+
* @param {number} multiplier - multiplier of part
|
|
436
|
+
* */
|
|
437
|
+
isoDateArray(size: number | true, type: DateTimeType, multiplier: number): Array<string>;
|
|
438
|
+
/**
|
|
439
|
+
* Generates a datetime array with type and multiplier and past-future option
|
|
440
|
+
*
|
|
441
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
442
|
+
* @param {DateTimeType} type - time part for multiplier
|
|
443
|
+
* @param {number} multiplier - multiplier of part
|
|
444
|
+
* @param {PastFuture} pastFuture - past-future option for multiplier
|
|
445
|
+
* */
|
|
446
|
+
isoDateArray(size: number | true, type: DateTimeType, multiplier: number, pastFuture: PastFuture): Array<string>;
|
|
447
|
+
/**
|
|
448
|
+
* Generates a date
|
|
449
|
+
* */
|
|
450
|
+
date(): string;
|
|
451
|
+
/**
|
|
452
|
+
* Generates a date with type
|
|
453
|
+
*
|
|
454
|
+
* @param {DateType} type - date part for multiplier
|
|
455
|
+
* */
|
|
456
|
+
date(type: DateType): string;
|
|
457
|
+
/**
|
|
458
|
+
* Generates a date with type and multiplier
|
|
459
|
+
*
|
|
460
|
+
* @param {DateType} type - date part for multiplier
|
|
461
|
+
* @param {number} multiplier - multiplier of part
|
|
462
|
+
* */
|
|
463
|
+
date(type: DateType, multiplier: number): string;
|
|
464
|
+
/**
|
|
465
|
+
* Generates a date with type and multiplier and past-future option
|
|
466
|
+
*
|
|
467
|
+
* @param {DateType} type - date part for multiplier
|
|
468
|
+
* @param {number} multiplier - multiplier of part
|
|
469
|
+
* @param {PastFuture} pastFuture - past-future option for multiplier
|
|
470
|
+
* */
|
|
471
|
+
date(type: DateType, multiplier: number, pastFuture: PastFuture): string;
|
|
472
|
+
/**
|
|
473
|
+
* Generates a date array
|
|
474
|
+
*
|
|
475
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
476
|
+
* */
|
|
477
|
+
dateArray(size: number | true): Array<string>;
|
|
478
|
+
/**
|
|
479
|
+
* Generates a date array with type
|
|
480
|
+
*
|
|
481
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
482
|
+
* @param {DateType} type - date part for multiplier
|
|
483
|
+
* */
|
|
484
|
+
dateArray(size: number | true, type: DateType): Array<string>;
|
|
485
|
+
/**
|
|
486
|
+
* Generates a date array with type and multiplier
|
|
487
|
+
*
|
|
488
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
489
|
+
* @param {DateType} type - date part for multiplier
|
|
490
|
+
* @param {number} multiplier - multiplier of part
|
|
491
|
+
* */
|
|
492
|
+
dateArray(size: number | true, type: DateType, multiplier: number): Array<string>;
|
|
493
|
+
/**
|
|
494
|
+
* Generates a date array with type and multiplier and past-future option
|
|
495
|
+
*
|
|
496
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
497
|
+
* @param {DateType} type - date part for multiplier
|
|
498
|
+
* @param {number} multiplier - multiplier of part
|
|
499
|
+
* @param {PastFuture} pastFuture - past-future option for multiplier
|
|
500
|
+
* */
|
|
501
|
+
dateArray(size: number | true, type: DateType, multiplier: number, pastFuture: PastFuture): Array<string>;
|
|
502
|
+
/**
|
|
503
|
+
* Generates a time like `23:59:59`
|
|
504
|
+
* */
|
|
505
|
+
time(): string;
|
|
506
|
+
/**
|
|
507
|
+
* Generates a time like `23:59:59` with type
|
|
508
|
+
*
|
|
509
|
+
* @param {DateType} type - date part for multiplier
|
|
510
|
+
* */
|
|
511
|
+
time(type: TimeType): string;
|
|
512
|
+
/**
|
|
513
|
+
* Generates a time like `23:59:59` with type and multiplier
|
|
514
|
+
*
|
|
515
|
+
* @param {DateType} type - date part for multiplier
|
|
516
|
+
* @param {number} multiplier - multiplier of part
|
|
517
|
+
* */
|
|
518
|
+
time(type: TimeType, multiplier: number): string;
|
|
519
|
+
/**
|
|
520
|
+
* Generates a time like `23:59:59` with type and multiplier and past-future option
|
|
521
|
+
*
|
|
522
|
+
* @param {DateType} type - date part for multiplier
|
|
523
|
+
* @param {number} multiplier - multiplier of part
|
|
524
|
+
* @param {PastFuture} pastFuture - past-future option for multiplier
|
|
525
|
+
* */
|
|
526
|
+
time(type: TimeType, multiplier: number, pastFuture: PastFuture): string;
|
|
527
|
+
/**
|
|
528
|
+
* Generates a time array like [`23:59:59`]
|
|
529
|
+
*
|
|
530
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
531
|
+
* */
|
|
532
|
+
timeArray(size: number | true): Array<string>;
|
|
533
|
+
/**
|
|
534
|
+
* Generates a time array like [`23:59:59`] with type
|
|
535
|
+
*
|
|
536
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
537
|
+
* @param {DateType} type - date part for multiplier
|
|
538
|
+
* */
|
|
539
|
+
timeArray(size: number | true, type: TimeType): Array<string>;
|
|
540
|
+
/**
|
|
541
|
+
* Generates a time array like [`23:59:59`] with type and multiplier
|
|
542
|
+
*
|
|
543
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
544
|
+
* @param {DateType} type - date part for multiplier
|
|
545
|
+
* @param {number} multiplier - multiplier of part
|
|
546
|
+
* */
|
|
547
|
+
timeArray(size: number | true, type: TimeType, multiplier: number): Array<string>;
|
|
548
|
+
/**
|
|
549
|
+
* Generates a time array like [`23:59:59`] with type and multiplier and past-future option
|
|
550
|
+
*
|
|
551
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
552
|
+
* @param {DateType} type - date part for multiplier
|
|
553
|
+
* @param {number} multiplier - multiplier of part
|
|
554
|
+
* @param {PastFuture} pastFuture - past-future option for multiplier
|
|
555
|
+
* */
|
|
556
|
+
timeArray(size: number | true, type: TimeType, multiplier: number, pastFuture: PastFuture): Array<string>;
|
|
557
|
+
/**
|
|
558
|
+
* Generates an enum
|
|
559
|
+
*
|
|
560
|
+
* @param {Array} keys - enum keys
|
|
561
|
+
* */
|
|
562
|
+
enum<T = string>(keys: unknown): T;
|
|
563
|
+
/**
|
|
564
|
+
* Generates an enum
|
|
565
|
+
*
|
|
566
|
+
* @param {Array} keys - enum keys
|
|
567
|
+
* */
|
|
568
|
+
enum<T = string>(keys: Array<string | number>): T;
|
|
569
|
+
/**
|
|
570
|
+
* Generates an enum
|
|
571
|
+
*
|
|
572
|
+
* @param {object} map - enum map
|
|
573
|
+
* */
|
|
574
|
+
enum<T = string>(map: Record<string, string | number>): T;
|
|
575
|
+
/**
|
|
576
|
+
* Generates an enum array
|
|
577
|
+
*
|
|
578
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
579
|
+
*
|
|
580
|
+
* @param {Array} keys - enum keys
|
|
581
|
+
* */
|
|
582
|
+
enumArray<T = string>(size: number | true, keys: unknown): Array<T>;
|
|
583
|
+
/**
|
|
584
|
+
* Generates an enum array
|
|
585
|
+
*
|
|
586
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
587
|
+
*
|
|
588
|
+
* @param {Array} keys - enum keys
|
|
589
|
+
* */
|
|
590
|
+
enumArray<T = string>(size: number | true, keys: Array<string | number>): Array<T>;
|
|
591
|
+
/**
|
|
592
|
+
* Generates an enum array
|
|
593
|
+
*
|
|
594
|
+
* @param {(number|true)} size - array size, if true then random(1,5)
|
|
595
|
+
* @param {object} map - enum map
|
|
596
|
+
* */
|
|
597
|
+
enumArray<T = string>(size: number | true, map: Record<string, string | number>): Array<T>;
|
|
598
|
+
/**
|
|
599
|
+
* Generates an urn
|
|
600
|
+
*
|
|
601
|
+
* @param {number} size - size of parts
|
|
602
|
+
* @param {string[]} keys - domain parts
|
|
603
|
+
* */
|
|
604
|
+
urn(size: number, ...keys: string[]): string;
|
|
605
|
+
/**
|
|
606
|
+
* Generates an urn
|
|
607
|
+
*
|
|
608
|
+
* @param {string[]} keys - domain parts
|
|
609
|
+
* */
|
|
610
|
+
urn(...keys: string[]): string;
|
|
611
|
+
/**
|
|
612
|
+
* Generates an urn
|
|
613
|
+
*
|
|
614
|
+
* */
|
|
615
|
+
urn(): string;
|
|
616
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./config"), exports);
|
|
18
|
+
__exportStar(require("./error"), exports);
|
|
19
|
+
__exportStar(require("./exit"), exports);
|
|
20
|
+
__exportStar(require("./generator"), exports);
|
|
21
|
+
__exportStar(require("./shared"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index.types';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./index.types"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface _Func {
|
|
2
|
+
readonly name?: string;
|
|
3
|
+
readonly length?: number;
|
|
4
|
+
bind(thisArg: any, ...args: Array<any>): any;
|
|
5
|
+
apply(thisArg: any, args: Array<any>): any;
|
|
6
|
+
call(thisArg: any, ...args: Array<any>): any;
|
|
7
|
+
}
|
|
8
|
+
export interface ClassLike<T = {}> extends _Func {
|
|
9
|
+
new (...args: Array<any>): T;
|
|
10
|
+
}
|
|
11
|
+
export {};
|