struct-fakerator 2.8.9 → 3.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.
Files changed (188) hide show
  1. package/LICENSE +21 -0
  2. package/dist/config.cjs +51 -0
  3. package/dist/config.js +2 -51
  4. package/dist/config_scheme.cjs +95 -0
  5. package/dist/config_scheme.js +24 -73
  6. package/dist/create_config.cjs +110 -0
  7. package/dist/create_config.js +9 -58
  8. package/dist/{create_generator_fn.mjs → create_generator_fn.cjs} +63 -11
  9. package/dist/create_generator_fn.js +11 -63
  10. package/dist/generator_fn.cjs +54 -0
  11. package/dist/generator_fn.js +2 -54
  12. package/dist/index.cjs +107 -0
  13. package/dist/index.js +6 -107
  14. package/dist/type.cjs +18 -0
  15. package/dist/type.js +0 -18
  16. package/dist/{type.d.ts → types/type.d.ts} +10 -1
  17. package/dist/types/utils/airline.d.ts +31 -0
  18. package/dist/{utils → types/utils}/animal.d.ts +2 -0
  19. package/dist/types/utils/book.d.ts +12 -0
  20. package/dist/{utils → types/utils}/color.d.ts +9 -9
  21. package/dist/{utils → types/utils}/finance.d.ts +7 -9
  22. package/dist/{utils → types/utils}/image.d.ts +0 -11
  23. package/dist/{utils → types/utils}/index.d.ts +2 -0
  24. package/dist/{utils → types/utils}/internet.d.ts +9 -7
  25. package/dist/{utils → types/utils}/location.d.ts +29 -16
  26. package/dist/{utils → types/utils}/number.d.ts +5 -0
  27. package/dist/{utils → types/utils}/person.d.ts +1 -1
  28. package/dist/{utils → types/utils}/science.d.ts +2 -2
  29. package/dist/{utils → types/utils}/string.d.ts +4 -0
  30. package/dist/utils/airline.cjs +62 -0
  31. package/dist/utils/airline.js +10 -46
  32. package/dist/utils/animal.cjs +98 -0
  33. package/dist/utils/animal.js +19 -94
  34. package/dist/utils/book.cjs +58 -0
  35. package/dist/utils/book.js +9 -0
  36. package/dist/utils/color.cjs +78 -0
  37. package/dist/utils/color.js +14 -78
  38. package/dist/utils/commerce.cjs +66 -0
  39. package/dist/utils/commerce.js +11 -66
  40. package/dist/utils/common.cjs +37 -0
  41. package/dist/utils/common.js +3 -37
  42. package/dist/utils/company.cjs +70 -0
  43. package/dist/utils/company.js +12 -70
  44. package/dist/utils/database.cjs +54 -0
  45. package/dist/utils/database.js +8 -54
  46. package/dist/utils/datatype.cjs +38 -0
  47. package/dist/utils/datatype.js +4 -38
  48. package/dist/utils/datetime.cjs +78 -0
  49. package/dist/utils/datetime.js +14 -78
  50. package/dist/utils/finance.cjs +114 -0
  51. package/dist/utils/finance.js +23 -110
  52. package/dist/utils/food.cjs +70 -0
  53. package/dist/utils/food.js +12 -70
  54. package/dist/utils/git.cjs +54 -0
  55. package/dist/utils/git.js +8 -54
  56. package/dist/utils/hacker.cjs +58 -0
  57. package/dist/utils/hacker.js +9 -58
  58. package/dist/utils/image.cjs +58 -0
  59. package/dist/utils/image.js +9 -66
  60. package/dist/utils/index.cjs +143 -0
  61. package/dist/utils/index.js +29 -136
  62. package/dist/utils/internet.cjs +118 -0
  63. package/dist/utils/internet.js +24 -114
  64. package/dist/utils/location.cjs +110 -0
  65. package/dist/utils/location.js +22 -98
  66. package/dist/utils/lorem.cjs +70 -0
  67. package/dist/utils/lorem.js +12 -70
  68. package/dist/utils/music.cjs +50 -0
  69. package/dist/utils/music.js +7 -50
  70. package/dist/utils/number.cjs +62 -0
  71. package/dist/utils/number.js +10 -58
  72. package/dist/utils/person.cjs +94 -0
  73. package/dist/utils/person.js +18 -94
  74. package/dist/utils/phone.cjs +42 -0
  75. package/dist/utils/phone.js +5 -42
  76. package/dist/utils/science.cjs +42 -0
  77. package/dist/utils/science.js +5 -42
  78. package/dist/utils/string.cjs +78 -0
  79. package/dist/utils/string.js +14 -74
  80. package/dist/utils/system.cjs +82 -0
  81. package/dist/utils/system.js +15 -82
  82. package/dist/utils/utils.cjs +39 -0
  83. package/dist/utils/utils.js +3 -37
  84. package/dist/utils/vehicle.cjs +70 -0
  85. package/dist/utils/vehicle.js +12 -70
  86. package/dist/utils/word.cjs +70 -0
  87. package/dist/utils/word.js +12 -70
  88. package/package.json +26 -36
  89. package/biome.json +0 -31
  90. package/dist/config.mjs +0 -2
  91. package/dist/config_scheme.mjs +0 -46
  92. package/dist/create_config.mjs +0 -61
  93. package/dist/generator_fn.mjs +0 -2
  94. package/dist/index.mjs +0 -6
  95. package/dist/type.mjs +0 -0
  96. package/dist/utils/airline.d.ts +0 -14
  97. package/dist/utils/airline.mjs +0 -6
  98. package/dist/utils/animal.mjs +0 -18
  99. package/dist/utils/color.mjs +0 -14
  100. package/dist/utils/commerce.mjs +0 -11
  101. package/dist/utils/common.mjs +0 -3
  102. package/dist/utils/company.mjs +0 -12
  103. package/dist/utils/database.mjs +0 -8
  104. package/dist/utils/datatype.mjs +0 -4
  105. package/dist/utils/datetime.mjs +0 -14
  106. package/dist/utils/finance.mjs +0 -22
  107. package/dist/utils/food.mjs +0 -12
  108. package/dist/utils/git.mjs +0 -8
  109. package/dist/utils/hacker.mjs +0 -9
  110. package/dist/utils/image.mjs +0 -11
  111. package/dist/utils/index.mjs +0 -27
  112. package/dist/utils/internet.mjs +0 -23
  113. package/dist/utils/location.mjs +0 -19
  114. package/dist/utils/lorem.mjs +0 -12
  115. package/dist/utils/music.mjs +0 -7
  116. package/dist/utils/number.mjs +0 -9
  117. package/dist/utils/person.mjs +0 -18
  118. package/dist/utils/phone.mjs +0 -5
  119. package/dist/utils/science.mjs +0 -5
  120. package/dist/utils/string.mjs +0 -13
  121. package/dist/utils/system.mjs +0 -15
  122. package/dist/utils/utils.mjs +0 -5
  123. package/dist/utils/vehicle.mjs +0 -12
  124. package/dist/utils/word.mjs +0 -12
  125. package/pnpm-workspace.yaml +0 -2
  126. package/rslib.config.ts +0 -26
  127. package/src/config.ts +0 -8
  128. package/src/config_scheme.ts +0 -41
  129. package/src/create_config.test.ts +0 -70
  130. package/src/create_config.ts +0 -170
  131. package/src/create_generator_fn.test.ts +0 -229
  132. package/src/create_generator_fn.ts +0 -342
  133. package/src/generator_fn.ts +0 -9
  134. package/src/index.ts +0 -5
  135. package/src/type.ts +0 -167
  136. package/src/utils/airline.ts +0 -11
  137. package/src/utils/animal.ts +0 -47
  138. package/src/utils/color.ts +0 -41
  139. package/src/utils/commerce.ts +0 -32
  140. package/src/utils/common.ts +0 -4
  141. package/src/utils/company.ts +0 -33
  142. package/src/utils/database.ts +0 -19
  143. package/src/utils/datatype.ts +0 -5
  144. package/src/utils/datetime.ts +0 -35
  145. package/src/utils/finance.ts +0 -65
  146. package/src/utils/food.ts +0 -29
  147. package/src/utils/git.ts +0 -17
  148. package/src/utils/hacker.ts +0 -20
  149. package/src/utils/image.ts +0 -26
  150. package/src/utils/index.ts +0 -26
  151. package/src/utils/internet.ts +0 -62
  152. package/src/utils/location.ts +0 -58
  153. package/src/utils/lorem.ts +0 -29
  154. package/src/utils/music.ts +0 -14
  155. package/src/utils/number.ts +0 -20
  156. package/src/utils/person.ts +0 -47
  157. package/src/utils/phone.ts +0 -8
  158. package/src/utils/science.ts +0 -8
  159. package/src/utils/string.ts +0 -32
  160. package/src/utils/system.ts +0 -40
  161. package/src/utils/utils.ts +0 -8
  162. package/src/utils/vehicle.ts +0 -29
  163. package/src/utils/word.ts +0 -29
  164. package/tsconfig.json +0 -18
  165. /package/dist/{config.d.ts → types/config.d.ts} +0 -0
  166. /package/dist/{config_scheme.d.ts → types/config_scheme.d.ts} +0 -0
  167. /package/dist/{create_config.d.ts → types/create_config.d.ts} +0 -0
  168. /package/dist/{create_config.test.d.ts → types/create_config.test.d.ts} +0 -0
  169. /package/dist/{create_generator_fn.d.ts → types/create_generator_fn.d.ts} +0 -0
  170. /package/dist/{create_generator_fn.test.d.ts → types/create_generator_fn.test.d.ts} +0 -0
  171. /package/dist/{generator_fn.d.ts → types/generator_fn.d.ts} +0 -0
  172. /package/dist/{index.d.ts → types/index.d.ts} +0 -0
  173. /package/dist/{utils → types/utils}/commerce.d.ts +0 -0
  174. /package/dist/{utils → types/utils}/common.d.ts +0 -0
  175. /package/dist/{utils → types/utils}/company.d.ts +0 -0
  176. /package/dist/{utils → types/utils}/database.d.ts +0 -0
  177. /package/dist/{utils → types/utils}/datatype.d.ts +0 -0
  178. /package/dist/{utils → types/utils}/datetime.d.ts +0 -0
  179. /package/dist/{utils → types/utils}/food.d.ts +0 -0
  180. /package/dist/{utils → types/utils}/git.d.ts +0 -0
  181. /package/dist/{utils → types/utils}/hacker.d.ts +0 -0
  182. /package/dist/{utils → types/utils}/lorem.d.ts +0 -0
  183. /package/dist/{utils → types/utils}/music.d.ts +0 -0
  184. /package/dist/{utils → types/utils}/phone.d.ts +0 -0
  185. /package/dist/{utils → types/utils}/system.d.ts +0 -0
  186. /package/dist/{utils → types/utils}/utils.d.ts +0 -0
  187. /package/dist/{utils → types/utils}/vehicle.d.ts +0 -0
  188. /package/dist/{utils → types/utils}/word.d.ts +0 -0
@@ -1,342 +0,0 @@
1
- import { faker } from "@faker-js/faker";
2
- import {
3
- arrayConfigScheme,
4
- boundedSeriesScheme,
5
- objConfigScheme,
6
- selectionConfigScheme,
7
- tupleConfigScheme,
8
- valueConfigScheme,
9
- } from "./config_scheme";
10
- import type {
11
- ArrayConfig,
12
- BoundedSeriesConfig,
13
- ObjectConfig,
14
- ObjectConfigWithFn,
15
- Result,
16
- SelectionConfig,
17
- TupleConfig,
18
- ValueConfig,
19
- } from "./type";
20
-
21
- type AllConfig<T> =
22
- | ValueConfig<T>
23
- | SelectionConfig<T>
24
- | ArrayConfig<T>
25
- | ObjectConfig<T>
26
- | ObjectConfigWithFn<T, unknown>
27
- | TupleConfig<T>
28
- | TupleConfig<T, T>
29
- | TupleConfig<T, T, T>
30
- | TupleConfig<T, T, T, T>
31
- | TupleConfig<T, T, T, T, T>
32
- | TupleConfig<T, T, T, T, T, T>
33
- | TupleConfig<T, T, T, T, T, T, T>
34
- | TupleConfig<T, T, T, T, T, T, T, T>
35
- | TupleConfig<T, T, T, T, T, T, T, T, T>
36
- | TupleConfig<T, T, T, T, T, T, T, T, T, T>
37
- | BoundedSeriesConfig;
38
-
39
- const _createValueGenerator = <R = unknown>(
40
- config: ValueConfig<unknown>,
41
- path: string,
42
- ): (() => R) => {
43
- try {
44
- valueConfigScheme.parse(config);
45
- } catch (err) {
46
- throw new Error(`config path: ${path}.value\n${err}`);
47
- }
48
-
49
- return config.generateFn as () => R;
50
- };
51
- export const createValueGenerator = <R = unknown>(
52
- config: ValueConfig<unknown>,
53
- ): (() => R) => _createValueGenerator(config, "*");
54
-
55
- // =================== generator fn ====================
56
-
57
- const _createSelectionGenerator = <T extends SelectionConfig<unknown>>(
58
- config: T,
59
- path: string,
60
- ): (() => Result<T>) => {
61
- try {
62
- selectionConfigScheme.parse(config);
63
- } catch (err) {
64
- throw new Error(`config path: ${path}.select\n${err}`);
65
- }
66
-
67
- const { items } = config;
68
-
69
- return (() => items[faker.number.int(items.length - 1)]) as () => Result<T>;
70
- };
71
-
72
- export const createSelectionGenerator = <T extends SelectionConfig<unknown>>(
73
- config: T,
74
- ): (() => Result<T>) => _createSelectionGenerator(config, "*");
75
-
76
- // =================== generator fn ====================
77
-
78
- const _createObjectGenerator = <
79
- T extends ObjectConfig<unknown> | ObjectConfigWithFn<unknown, unknown>,
80
- >(
81
- config: T,
82
- path: string,
83
- customTypeMatch?: (config: unknown, path: string) => ValueConfig<unknown>,
84
- ): (() => Result<T>) => {
85
- try {
86
- objConfigScheme.parse(config);
87
- } catch (err) {
88
- throw new Error(`config path: ${path}.obj\n ${err}`);
89
- }
90
-
91
- const keyWithFns: [string, () => Result<AllConfig<unknown>>][] =
92
- Object.entries(config.content as object).map(([key, subConfig]) => [
93
- key,
94
- _createGeneratorByType(subConfig, `${path}.obj[${key}]`, customTypeMatch),
95
- ]);
96
-
97
- return () => {
98
- const result: Record<string, unknown> = {};
99
- for (const [key, generateFn] of keyWithFns) {
100
- result[key] = generateFn();
101
- }
102
-
103
- if ("transformer" in config && typeof config.transformer === "function") {
104
- return config.transformer(result) as Result<T>;
105
- }
106
- return result as Result<T>;
107
- };
108
- };
109
- export const createObjectGenerator = <T extends ObjectConfig<unknown>>(
110
- config: T,
111
- customTypeMatch?: (config: unknown, path?: string) => ValueConfig<unknown>,
112
- ): (() => Result<T>) => _createObjectGenerator(config, "*", customTypeMatch);
113
-
114
- // =================== generator fn ====================
115
-
116
- const _createArrayGenerator = <T extends ArrayConfig<unknown>>(
117
- config: T,
118
- path: string,
119
- customTypeMatch?: (config: unknown, path: string) => ValueConfig<unknown>,
120
- ): (() => Result<T>) => {
121
- try {
122
- arrayConfigScheme.parse(config);
123
- } catch (err) {
124
- throw new Error(`config path: ${path}.arr\n ${err}`);
125
- }
126
-
127
- const itemGeneratorFn = _createGeneratorByType(
128
- config.item as AllConfig<unknown>,
129
- `${path}.arr`,
130
- customTypeMatch,
131
- ) as () => Result<T>;
132
-
133
- if (config.next) {
134
- const next: (prev: Result<T>, current: Result<T>) => Result<T> =
135
- config.next;
136
- return () => {
137
- let prev = itemGeneratorFn();
138
- const result = [];
139
- for (let i = 0; i < config.len; i++) {
140
- const nextValue = next(prev, itemGeneratorFn());
141
- result.push(nextValue);
142
- prev = nextValue;
143
- }
144
-
145
- return result as Result<T>;
146
- };
147
- }
148
-
149
- return () =>
150
- Array.from({ length: config.len ?? 0 }, itemGeneratorFn) as Result<T>;
151
- };
152
- export const createArrayGenerator = <T extends ArrayConfig<unknown>>(
153
- config: T,
154
- customTypeMatch?: (config: unknown, path?: string) => ValueConfig<unknown>,
155
- ): (() => Result<T>) => _createArrayGenerator(config, "*", customTypeMatch);
156
-
157
- // =================== generator fn ====================
158
-
159
- const _createTupleGenerator = <
160
- T extends
161
- | TupleConfig<
162
- unknown,
163
- unknown,
164
- unknown,
165
- unknown,
166
- unknown,
167
- unknown,
168
- unknown,
169
- unknown,
170
- unknown,
171
- unknown
172
- >
173
- | TupleConfig<
174
- unknown,
175
- unknown,
176
- unknown,
177
- unknown,
178
- unknown,
179
- unknown,
180
- unknown,
181
- unknown,
182
- unknown
183
- >
184
- | TupleConfig<
185
- unknown,
186
- unknown,
187
- unknown,
188
- unknown,
189
- unknown,
190
- unknown,
191
- unknown,
192
- unknown
193
- >
194
- | TupleConfig<unknown, unknown, unknown, unknown, unknown, unknown>
195
- | TupleConfig<unknown, unknown, unknown, unknown, unknown>
196
- | TupleConfig<unknown, unknown, unknown, unknown>
197
- | TupleConfig<unknown, unknown, unknown>
198
- | TupleConfig<unknown, unknown>
199
- | TupleConfig<unknown>,
200
- >(
201
- config: T,
202
- path: string,
203
- customTypeMatch?: (config: unknown, path?: string) => ValueConfig<unknown>,
204
- ): (() => Result<T>) => {
205
- try {
206
- tupleConfigScheme.parse(config);
207
- } catch (err) {
208
- throw new Error(`config path: ${path}.tuple\n ${err}`);
209
- }
210
-
211
- const itemsFns = config.configItems.map((configItem, index) =>
212
- _createGeneratorByType(
213
- configItem as AllConfig<unknown>,
214
- `${path}.tuple[${index}]`,
215
- customTypeMatch,
216
- ),
217
- );
218
-
219
- return () => itemsFns.map((generateFn) => generateFn()) as Result<T>;
220
- };
221
- export const createTupleGenerator = <
222
- T extends
223
- | TupleConfig<
224
- unknown,
225
- unknown,
226
- unknown,
227
- unknown,
228
- unknown,
229
- unknown,
230
- unknown,
231
- unknown,
232
- unknown,
233
- unknown
234
- >
235
- | TupleConfig<
236
- unknown,
237
- unknown,
238
- unknown,
239
- unknown,
240
- unknown,
241
- unknown,
242
- unknown,
243
- unknown,
244
- unknown
245
- >
246
- | TupleConfig<
247
- unknown,
248
- unknown,
249
- unknown,
250
- unknown,
251
- unknown,
252
- unknown,
253
- unknown,
254
- unknown
255
- >
256
- | TupleConfig<unknown, unknown, unknown, unknown, unknown, unknown>
257
- | TupleConfig<unknown, unknown, unknown, unknown, unknown>
258
- | TupleConfig<unknown, unknown, unknown, unknown>
259
- | TupleConfig<unknown, unknown, unknown>
260
- | TupleConfig<unknown, unknown>
261
- | TupleConfig<unknown>,
262
- >(
263
- config: T,
264
- customTypeMatch?: (config: unknown, path: string) => ValueConfig<unknown>,
265
- ): (() => Result<T>) => _createTupleGenerator(config, "*", customTypeMatch);
266
-
267
- // =================== generator fn ====================
268
-
269
- const _createBoundedSeriesGenerator = <T extends BoundedSeriesConfig>(
270
- config: T,
271
- path: string,
272
- ): (() => Result<T>) => {
273
- try {
274
- boundedSeriesScheme.parse(config);
275
- } catch (err) {
276
- throw new Error(`config path: ${path}.boundedSeries\n ${err}`);
277
- }
278
-
279
- const { upperLimit, lowerLimit, createInitValue, count } = config;
280
-
281
- return () => {
282
- let value = createInitValue();
283
-
284
- const boundedSeries = [];
285
-
286
- for (let i = 0; i < count; i++) {
287
- value = faker.number.float({ max: upperLimit, min: lowerLimit }) * value;
288
- boundedSeries.push(value);
289
- }
290
-
291
- return boundedSeries as Result<T>;
292
- };
293
- };
294
- export const createBoundedSeriesGenerator = <T extends BoundedSeriesConfig>(
295
- config: T,
296
- ): (() => Result<T>) => _createBoundedSeriesGenerator(config, "*");
297
-
298
- // =================== generator fn ====================
299
-
300
- const _createGeneratorByType = <T extends AllConfig<unknown>>(
301
- config: T,
302
- path: string,
303
- customTypeMatch?: (config: unknown, path: string) => ValueConfig<unknown>,
304
- ): (() => Result<T>) => {
305
- switch (config.type) {
306
- case "obj":
307
- return _createObjectGenerator(
308
- config,
309
- path,
310
- customTypeMatch,
311
- ) as () => Result<T>;
312
- case "arr":
313
- return _createArrayGenerator(
314
- config,
315
- path,
316
- customTypeMatch,
317
- ) as () => Result<T>;
318
- case "tuple":
319
- return _createTupleGenerator(
320
- config,
321
- path,
322
- customTypeMatch,
323
- ) as () => Result<T>;
324
- case "select":
325
- return _createSelectionGenerator(config, path) as () => Result<T>;
326
- case "value":
327
- return _createValueGenerator(config, path);
328
- case "bounded_series":
329
- return _createBoundedSeriesGenerator(config, path) as () => Result<T>;
330
- default: {
331
- if (customTypeMatch) {
332
- return createValueGenerator(customTypeMatch(config, path));
333
- }
334
- throw new Error(`path: ${path}\nconfig type is not supported`);
335
- }
336
- }
337
- };
338
-
339
- export const createGeneratorByType = <T extends AllConfig<unknown>>(
340
- config: T,
341
- customTypeMatch?: (config: unknown, path: string) => ValueConfig<unknown>,
342
- ): (() => Result<T>) => _createGeneratorByType(config, "*", customTypeMatch);
@@ -1,9 +0,0 @@
1
- export {
2
- createArrayGenerator as genArrayFn,
3
- createBoundedSeriesGenerator as genBoundedSeriesFn,
4
- createGeneratorByType as genFn,
5
- createObjectGenerator as genObjectFn,
6
- createSelectionGenerator as genSelectFn,
7
- createTupleGenerator as genTupleFn,
8
- createValueGenerator as genValueFn,
9
- } from "./create_generator_fn";
package/src/index.ts DELETED
@@ -1,5 +0,0 @@
1
- export * as StructConfig from "./config";
2
- export * from "./create_config";
3
- export * from "./create_generator_fn";
4
- export * as StructGenerator from "./generator_fn";
5
- export * from "./type";
package/src/type.ts DELETED
@@ -1,167 +0,0 @@
1
- export type ValueConfig<T> = {
2
- type: "value";
3
- generateFn: () => T;
4
- };
5
-
6
- export type SelectionConfig<T> = {
7
- type: "select";
8
- items: T[];
9
- };
10
-
11
- export type BoundedSeriesConfig = {
12
- type: "bounded_series";
13
- upperLimit: number;
14
- lowerLimit: number;
15
- createInitValue: () => number;
16
- count: number;
17
- };
18
-
19
- export type ArrayConfig<T> = {
20
- type: "arr";
21
- item: T;
22
- len: number;
23
- next?: (prev: Result<T>, current: Result<T>) => Result<T>;
24
- };
25
-
26
- export type ObjectConfig<T> = {
27
- type: "obj";
28
- content: T;
29
- };
30
-
31
- export type ObjectConfigWithFn<T, R> = {
32
- type: "obj";
33
- content: T;
34
- transformer: (v: { [K in keyof T]: Result<T[K]> }) => R;
35
- };
36
-
37
- export type TupleItems<A, B, C, D, E, F, G, H, I, J> = J extends undefined
38
- ? I extends undefined
39
- ? H extends undefined
40
- ? G extends undefined
41
- ? F extends undefined
42
- ? E extends undefined
43
- ? D extends undefined
44
- ? C extends undefined
45
- ? B extends undefined
46
- ? [A]
47
- : [A, B]
48
- : [A, B, C]
49
- : [A, B, C, D]
50
- : [A, B, C, D, E]
51
- : [A, B, C, D, E, F]
52
- : [A, B, C, D, E, F, G]
53
- : [A, B, C, D, E, F, G, H]
54
- : [A, B, C, D, E, F, G, H, I]
55
- : [A, B, C, D, E, F, G, H, I, J];
56
-
57
- export type TupleConfig<
58
- A,
59
- B = undefined,
60
- C = undefined,
61
- D = undefined,
62
- E = undefined,
63
- F = undefined,
64
- G = undefined,
65
- H = undefined,
66
- I = undefined,
67
- J = undefined,
68
- > = {
69
- type: "tuple";
70
- configItems: TupleItems<A, B, C, D, E, F, G, H, I, J>;
71
- };
72
-
73
- export type Result<T> = T extends ValueConfig<infer U>
74
- ? U
75
- : T extends SelectionConfig<infer S>
76
- ? S
77
- : T extends BoundedSeriesConfig
78
- ? number[]
79
- : T extends ArrayConfig<infer W>
80
- ? Array<Result<W>>
81
- : T extends ObjectConfigWithFn<infer _, infer R>
82
- ? R
83
- : T extends ObjectConfig<infer O>
84
- ? { [K in keyof O]: Result<O[K]> }
85
- : T extends TupleConfig<
86
- infer A,
87
- infer B,
88
- infer C,
89
- infer D,
90
- infer E,
91
- infer F,
92
- infer G,
93
- infer H,
94
- infer I,
95
- infer J
96
- >
97
- ? J extends undefined
98
- ? I extends undefined
99
- ? H extends undefined
100
- ? G extends undefined
101
- ? F extends undefined
102
- ? E extends undefined
103
- ? D extends undefined
104
- ? C extends undefined
105
- ? B extends undefined
106
- ? [Result<A>]
107
- : [Result<A>, Result<B>]
108
- : [Result<A>, Result<B>, Result<C>]
109
- : [Result<A>, Result<B>, Result<C>, Result<D>]
110
- : [
111
- Result<A>,
112
- Result<B>,
113
- Result<C>,
114
- Result<D>,
115
- Result<E>,
116
- ]
117
- : [
118
- Result<A>,
119
- Result<B>,
120
- Result<C>,
121
- Result<D>,
122
- Result<E>,
123
- Result<F>,
124
- ]
125
- : [
126
- Result<A>,
127
- Result<B>,
128
- Result<C>,
129
- Result<D>,
130
- Result<E>,
131
- Result<F>,
132
- Result<G>,
133
- ]
134
- : [
135
- Result<A>,
136
- Result<B>,
137
- Result<C>,
138
- Result<D>,
139
- Result<E>,
140
- Result<F>,
141
- Result<G>,
142
- Result<H>,
143
- ]
144
- : [
145
- Result<A>,
146
- Result<B>,
147
- Result<C>,
148
- Result<D>,
149
- Result<E>,
150
- Result<F>,
151
- Result<G>,
152
- Result<H>,
153
- Result<I>,
154
- ]
155
- : [
156
- Result<A>,
157
- Result<B>,
158
- Result<C>,
159
- Result<D>,
160
- Result<E>,
161
- Result<F>,
162
- Result<G>,
163
- Result<H>,
164
- Result<I>,
165
- Result<J>,
166
- ]
167
- : never;
@@ -1,11 +0,0 @@
1
- import { faker } from "@faker-js/faker";
2
- import { makeValueConfigFn } from "./utils";
3
-
4
- /** Airline [aircraftType](https://fakerjs.dev/api/airline.html#aircraftType) */
5
- export const aircraftType = makeValueConfigFn(faker.airline.aircraftType);
6
-
7
- /** Airline [flightNumber](https://fakerjs.dev/api/airline.html#flightNumber) */
8
- export const flightNumber = makeValueConfigFn(faker.airline.flightNumber);
9
-
10
- /** Airline [seat](https://fakerjs.dev/api/airline.html#seat) */
11
- export const seat = makeValueConfigFn(faker.airline.seat);
@@ -1,47 +0,0 @@
1
- import { faker } from "@faker-js/faker";
2
- import { makeValueConfigFn } from "./utils";
3
-
4
- /** Animal [bear](https://fakerjs.dev/api/animal.html#bear) */
5
- export const bear = makeValueConfigFn(faker.animal.bear);
6
-
7
- /** Animal [bird](https://fakerjs.dev/api/animal.html#bird) */
8
- export const bird = makeValueConfigFn(faker.animal.bird);
9
-
10
- /** Animal [cat](https://fakerjs.dev/api/animal.html#cat) */
11
- export const cat = makeValueConfigFn(faker.animal.cat);
12
-
13
- /** Animal [cetacean](https://fakerjs.dev/api/animal.html#cetacean) */
14
- export const cetacean = makeValueConfigFn(faker.animal.cetacean);
15
-
16
- /** Animal [cow](https://fakerjs.dev/api/animal.html#cow) */
17
- export const cow = makeValueConfigFn(faker.animal.cow);
18
-
19
- /** Animal [crocodilia](https://fakerjs.dev/api/animal.html#crocodilia) */
20
- export const crocodilia = makeValueConfigFn(faker.animal.crocodilia);
21
-
22
- /** Animal [dog](https://fakerjs.dev/api/animal.html#dog) */
23
- export const dog = makeValueConfigFn(faker.animal.dog);
24
-
25
- /** Animal [fish](https://fakerjs.dev/api/animal.html#fish) */
26
- export const fish = makeValueConfigFn(faker.animal.fish);
27
-
28
- /** Animal [horse](https://fakerjs.dev/api/animal.html#horse) */
29
- export const horse = makeValueConfigFn(faker.animal.horse);
30
-
31
- /** Animal [insect](https://fakerjs.dev/api/animal.html#insect) */
32
- export const insect = makeValueConfigFn(faker.animal.insect);
33
-
34
- /** Animal [lion](https://fakerjs.dev/api/animal.html#lion) */
35
- export const lion = makeValueConfigFn(faker.animal.lion);
36
-
37
- /** Animal [rabbit](https://fakerjs.dev/api/animal.html#rabbit) */
38
- export const rabbit = makeValueConfigFn(faker.animal.rabbit);
39
-
40
- /** Animal [rodent](https://fakerjs.dev/api/animal.html#rodent) */
41
- export const rodent = makeValueConfigFn(faker.animal.rodent);
42
-
43
- /** Animal [snake](https://fakerjs.dev/api/animal.html#snake) */
44
- export const snake = makeValueConfigFn(faker.animal.snake);
45
-
46
- /** Animal [type](https://fakerjs.dev/api/animal.html#type) */
47
- export const type = makeValueConfigFn(faker.animal.type);
@@ -1,41 +0,0 @@
1
- import { faker } from "@faker-js/faker";
2
- import { makeValueConfigFn } from "./utils";
3
-
4
- /** Color [cmyk](https://fakerjs.dev/api/color.html#cmyk) */
5
- export const cmyk = makeValueConfigFn(faker.color.cmyk);
6
-
7
- /** Color [colorByCSSColorSpace](https://fakerjs.dev/api/color.html#colorByCSSColorSpace) */
8
- export const colorByCSSColorSpace = makeValueConfigFn(
9
- faker.color.colorByCSSColorSpace,
10
- );
11
-
12
- /** Color [cssSupportedFunction](https://fakerjs.dev/api/color.html#cssSupportedFunction) */
13
- export const cssSupportedFunction = makeValueConfigFn(
14
- faker.color.cssSupportedFunction,
15
- );
16
-
17
- /** Color [cssSupportedSpace](https://fakerjs.dev/api/color.html#cssSupportedSpace) */
18
- export const cssSupportedSpace = makeValueConfigFn(
19
- faker.color.cssSupportedSpace,
20
- );
21
-
22
- /** Color [hsl](https://fakerjs.dev/api/color.html#hsl) */
23
- export const hsl = makeValueConfigFn(faker.color.hsl);
24
-
25
- /** Color [human](https://fakerjs.dev/api/color.html#human) */
26
- export const human = makeValueConfigFn(faker.color.human);
27
-
28
- /** Color [hwb](https://fakerjs.dev/api/color.html#hwb) */
29
- export const hwb = makeValueConfigFn(faker.color.hwb);
30
-
31
- /** Color [lab](https://fakerjs.dev/api/color.html#lab) */
32
- export const lab = makeValueConfigFn(faker.color.lab);
33
-
34
- /** Color [lch](https://fakerjs.dev/api/color.html#lch) */
35
- export const lch = makeValueConfigFn(faker.color.lch);
36
-
37
- /** Color [rgb](https://fakerjs.dev/api/color.html#rgb) */
38
- export const rgb = makeValueConfigFn(faker.color.rgb);
39
-
40
- /** Color [space](https://fakerjs.dev/api/color.html#space) */
41
- export const space = makeValueConfigFn(faker.color.space);
@@ -1,32 +0,0 @@
1
- import { faker } from "@faker-js/faker";
2
- import { makeValueConfigFn } from "./utils";
3
-
4
- /** Commerce [department](https://fakerjs.dev/api/commerce.html#department) */
5
- export const department = makeValueConfigFn(faker.commerce.department);
6
-
7
- /** Commerce [isbn](https://fakerjs.dev/api/commerce.html#isbn) */
8
- export const isbn = makeValueConfigFn(faker.commerce.isbn);
9
-
10
- /** Commerce [price](https://fakerjs.dev/api/commerce.html#price) */
11
- export const price = makeValueConfigFn(faker.commerce.price);
12
-
13
- /** Commerce [product](https://fakerjs.dev/api/commerce.html#product) */
14
- export const product = makeValueConfigFn(faker.commerce.product);
15
-
16
- /** Commerce [productAdjective](https://fakerjs.dev/api/commerce.html#productAdjective) */
17
- export const productAdjective = makeValueConfigFn(
18
- faker.commerce.productAdjective,
19
- );
20
-
21
- /** Commerce [productDescription](https://fakerjs.dev/api/commerce.html#productDescription) */
22
- export const productDescription = makeValueConfigFn(
23
- faker.commerce.productDescription,
24
- );
25
-
26
- /** Commerce [productMaterial](https://fakerjs.dev/api/commerce.html#productMaterial) */
27
- export const productMaterial = makeValueConfigFn(
28
- faker.commerce.productMaterial,
29
- );
30
-
31
- /** Commerce [productName](https://fakerjs.dev/api/commerce.html#productName) */
32
- export const productName = makeValueConfigFn(faker.commerce.productName);
@@ -1,4 +0,0 @@
1
- import { createValueConfig } from "../create_config";
2
-
3
- /** Common constant */
4
- export const constant = <T>(value: T) => createValueConfig(() => value);
@@ -1,33 +0,0 @@
1
- import { faker } from "@faker-js/faker";
2
- import { makeValueConfigFn } from "./utils";
3
-
4
- /** Company [buzzAdjective](https://fakerjs.dev/api/company.html#buzzAdjective) */
5
- export const buzzAdjective = makeValueConfigFn(faker.company.buzzAdjective);
6
-
7
- /** Company [buzzNoun](https://fakerjs.dev/api/company.html#buzzNoun) */
8
- export const buzzNoun = makeValueConfigFn(faker.company.buzzNoun);
9
-
10
- /** Company [buzzPhrase](https://fakerjs.dev/api/company.html#buzzPhrase) */
11
- export const buzzPhrase = makeValueConfigFn(faker.company.buzzPhrase);
12
-
13
- /** Company [buzzVerb](https://fakerjs.dev/api/company.html#buzzVerb) */
14
- export const buzzVerb = makeValueConfigFn(faker.company.buzzVerb);
15
-
16
- /** Company [catchPhrase](https://fakerjs.dev/api/company.html#catchPhrase) */
17
- export const catchPhrase = makeValueConfigFn(faker.company.catchPhrase);
18
-
19
- /** Company [catchPhraseAdjective](https://fakerjs.dev/api/company.html#catchPhraseAdjective) */
20
- export const catchPhraseAdjective = makeValueConfigFn(
21
- faker.company.catchPhraseAdjective,
22
- );
23
-
24
- /** Company [catchPhraseDescriptor](https://fakerjs.dev/api/company.html#catchPhraseDescriptor) */
25
- export const catchPhraseDescriptor = makeValueConfigFn(
26
- faker.company.catchPhraseDescriptor,
27
- );
28
-
29
- /** Company [catchPhraseNoun](https://fakerjs.dev/api/company.html#catchPhraseNoun) */
30
- export const catchPhraseNoun = makeValueConfigFn(faker.company.catchPhraseNoun);
31
-
32
- /** Company [name](https://fakerjs.dev/api/company.html#name) */
33
- export const name = makeValueConfigFn(faker.company.name);