struct-fakerator 2.6.9 → 2.8.9

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 (300) hide show
  1. package/README.md +148 -93
  2. package/biome.json +30 -26
  3. package/dist/config.d.ts +1 -2
  4. package/dist/config.js +51 -19
  5. package/dist/config.mjs +2 -19
  6. package/dist/config_scheme.d.ts +7 -10
  7. package/dist/config_scheme.js +95 -17
  8. package/dist/config_scheme.mjs +46 -17
  9. package/dist/create_config.d.ts +9 -11
  10. package/dist/create_config.js +110 -18
  11. package/dist/create_config.mjs +60 -17
  12. package/dist/create_config.test.d.ts +1 -2
  13. package/dist/create_generator_fn.d.ts +9 -11
  14. package/dist/create_generator_fn.js +168 -21
  15. package/dist/create_generator_fn.mjs +115 -20
  16. package/dist/create_generator_fn.test.d.ts +1 -2
  17. package/dist/generator_fn.d.ts +1 -2
  18. package/dist/generator_fn.js +54 -22
  19. package/dist/generator_fn.mjs +2 -22
  20. package/dist/index.d.ts +5 -5
  21. package/dist/index.js +107 -44
  22. package/dist/index.mjs +6 -44
  23. package/dist/type.d.ts +10 -12
  24. package/dist/type.js +18 -1
  25. package/dist/type.mjs +0 -1
  26. package/dist/utils/airline.d.ts +14 -3
  27. package/dist/utils/airline.js +46 -15
  28. package/dist/utils/airline.mjs +6 -15
  29. package/dist/utils/animal.d.ts +30 -2
  30. package/dist/utils/animal.js +94 -39
  31. package/dist/utils/animal.mjs +18 -39
  32. package/dist/utils/color.d.ts +41 -3
  33. package/dist/utils/color.js +78 -31
  34. package/dist/utils/color.mjs +14 -31
  35. package/dist/utils/commerce.d.ts +24 -2
  36. package/dist/utils/commerce.js +66 -25
  37. package/dist/utils/commerce.mjs +11 -25
  38. package/dist/utils/common.d.ts +2 -2
  39. package/dist/utils/common.js +37 -9
  40. package/dist/utils/common.mjs +3 -9
  41. package/dist/utils/company.d.ts +18 -2
  42. package/dist/utils/company.js +70 -27
  43. package/dist/utils/company.mjs +12 -27
  44. package/dist/utils/database.d.ts +10 -2
  45. package/dist/utils/database.js +54 -19
  46. package/dist/utils/database.mjs +8 -19
  47. package/dist/utils/datatype.d.ts +4 -2
  48. package/dist/utils/datatype.js +38 -11
  49. package/dist/utils/datatype.mjs +4 -11
  50. package/dist/utils/datetime.d.ts +59 -2
  51. package/dist/utils/datetime.js +78 -31
  52. package/dist/utils/datetime.mjs +14 -31
  53. package/dist/utils/finance.d.ts +62 -3
  54. package/dist/utils/finance.js +110 -47
  55. package/dist/utils/finance.mjs +22 -47
  56. package/dist/utils/food.d.ts +18 -2
  57. package/dist/utils/food.js +70 -27
  58. package/dist/utils/food.mjs +12 -27
  59. package/dist/utils/git.d.ts +18 -2
  60. package/dist/utils/git.js +54 -19
  61. package/dist/utils/git.mjs +8 -19
  62. package/dist/utils/hacker.d.ts +12 -2
  63. package/dist/utils/hacker.js +58 -21
  64. package/dist/utils/hacker.mjs +9 -21
  65. package/dist/utils/image.d.ts +40 -2
  66. package/dist/utils/image.js +66 -25
  67. package/dist/utils/image.mjs +11 -25
  68. package/dist/utils/index.d.ts +26 -28
  69. package/dist/utils/index.js +136 -110
  70. package/dist/utils/index.mjs +27 -110
  71. package/dist/utils/internet.d.ts +77 -3
  72. package/dist/utils/internet.js +114 -49
  73. package/dist/utils/internet.mjs +23 -49
  74. package/dist/utils/location.d.ts +56 -2
  75. package/dist/utils/location.js +98 -41
  76. package/dist/utils/location.mjs +19 -41
  77. package/dist/utils/lorem.d.ts +45 -2
  78. package/dist/utils/lorem.js +70 -27
  79. package/dist/utils/lorem.mjs +12 -27
  80. package/dist/utils/music.d.ts +8 -2
  81. package/dist/utils/music.js +50 -17
  82. package/dist/utils/music.mjs +7 -17
  83. package/dist/utils/number.d.ts +34 -2
  84. package/dist/utils/number.js +58 -21
  85. package/dist/utils/number.mjs +9 -21
  86. package/dist/utils/person.d.ts +34 -3
  87. package/dist/utils/person.js +94 -39
  88. package/dist/utils/person.mjs +18 -39
  89. package/dist/utils/phone.d.ts +6 -2
  90. package/dist/utils/phone.js +42 -13
  91. package/dist/utils/phone.mjs +5 -13
  92. package/dist/utils/science.d.ts +4 -3
  93. package/dist/utils/science.js +42 -13
  94. package/dist/utils/science.mjs +5 -13
  95. package/dist/utils/string.d.ts +69 -2
  96. package/dist/utils/string.js +74 -29
  97. package/dist/utils/string.mjs +13 -29
  98. package/dist/utils/system.d.ts +35 -2
  99. package/dist/utils/system.js +82 -33
  100. package/dist/utils/system.mjs +15 -33
  101. package/dist/utils/utils.d.ts +2 -2
  102. package/dist/utils/utils.js +39 -9
  103. package/dist/utils/utils.mjs +5 -9
  104. package/dist/utils/vehicle.d.ts +18 -2
  105. package/dist/utils/vehicle.js +70 -27
  106. package/dist/utils/vehicle.mjs +12 -27
  107. package/dist/utils/word.d.ts +18 -22
  108. package/dist/utils/word.js +70 -31
  109. package/dist/utils/word.mjs +12 -31
  110. package/package.json +10 -31
  111. package/pnpm-workspace.yaml +2 -0
  112. package/rslib.config.ts +26 -0
  113. package/src/config.ts +3 -3
  114. package/src/config_scheme.ts +1 -1
  115. package/src/create_config.test.ts +0 -1
  116. package/src/create_config.ts +1 -1
  117. package/src/create_generator_fn.test.ts +13 -2
  118. package/src/create_generator_fn.ts +5 -5
  119. package/src/generator_fn.ts +1 -1
  120. package/src/index.ts +2 -2
  121. package/src/type.ts +1 -1
  122. package/src/utils/index.ts +1 -2
  123. package/src/utils/internet.ts +1 -1
  124. package/src/utils/utils.ts +1 -1
  125. package/tsconfig.json +2 -1
  126. package/dist/airline-98MCzMN8.d.ts +0 -26
  127. package/dist/airline-CuAxOEYH.d.mts +0 -26
  128. package/dist/animal-BohQ7s0w.d.mts +0 -53
  129. package/dist/animal-o8BFF7gd.d.ts +0 -53
  130. package/dist/chunk-23I6D5SJ.js +0 -57
  131. package/dist/chunk-3KXIZTCT.mjs +0 -20
  132. package/dist/chunk-3U6BNHWG.mjs +0 -2040
  133. package/dist/chunk-4DDCMYY5.mjs +0 -57
  134. package/dist/chunk-4VNS5WPM.js +0 -42
  135. package/dist/chunk-5KF6D2RT.js +0 -63
  136. package/dist/chunk-5O3L5474.mjs +0 -45
  137. package/dist/chunk-5PCDQHI5.mjs +0 -21
  138. package/dist/chunk-62INTWCD.mjs +0 -36
  139. package/dist/chunk-6HRHPVPM.js +0 -35
  140. package/dist/chunk-6UFUX7X4.js +0 -51
  141. package/dist/chunk-6ZK2LMFM.js +0 -21
  142. package/dist/chunk-7BIWHK77.js +0 -42
  143. package/dist/chunk-7UQSPUCL.mjs +0 -0
  144. package/dist/chunk-7VOPOQZO.js +0 -45
  145. package/dist/chunk-C3RGM3CB.js +0 -67
  146. package/dist/chunk-DGW666Q6.mjs +0 -48
  147. package/dist/chunk-DM5VFX6B.js +0 -17008
  148. package/dist/chunk-DTC7Q7P5.js +0 -45
  149. package/dist/chunk-EM67LVYX.mjs +0 -18
  150. package/dist/chunk-EMCK2BLM.js +0 -45
  151. package/dist/chunk-ES2CYGB7.js +0 -24
  152. package/dist/chunk-ET6EJB33.js +0 -36
  153. package/dist/chunk-EYOBG3PQ.mjs +0 -45
  154. package/dist/chunk-F4GVSNLH.js +0 -30
  155. package/dist/chunk-G43WDHZO.mjs +0 -63
  156. package/dist/chunk-GJSTX6ZS.mjs +0 -24
  157. package/dist/chunk-GYF6YSNX.js +0 -74
  158. package/dist/chunk-HBJP434N.mjs +0 -78
  159. package/dist/chunk-IAR3DUKD.js +0 -49
  160. package/dist/chunk-IL4E3ZNB.js +0 -78
  161. package/dist/chunk-IOXGSFEU.js +0 -20
  162. package/dist/chunk-JB6NCVX3.mjs +0 -63
  163. package/dist/chunk-JGY3KVDU.mjs +0 -45
  164. package/dist/chunk-JWCDEYMY.js +0 -48
  165. package/dist/chunk-LSFOERXQ.js +0 -18
  166. package/dist/chunk-MGR2M7BS.mjs +0 -56
  167. package/dist/chunk-MLJAHDYX.mjs +0 -167
  168. package/dist/chunk-MROZIQOV.mjs +0 -51
  169. package/dist/chunk-NHYNERHW.js +0 -56
  170. package/dist/chunk-PGSJJESY.js +0 -27
  171. package/dist/chunk-QTVSUA5W.mjs +0 -24
  172. package/dist/chunk-QZQ32UPU.mjs +0 -28
  173. package/dist/chunk-R2MQ3IW5.mjs +0 -33
  174. package/dist/chunk-RD2SB2KT.js +0 -36
  175. package/dist/chunk-RDZI4CMI.mjs +0 -42
  176. package/dist/chunk-RTYV5XDU.mjs +0 -36
  177. package/dist/chunk-RZPUHXXO.mjs +0 -49
  178. package/dist/chunk-SD3HVRQN.mjs +0 -48
  179. package/dist/chunk-SN4QTD6R.js +0 -1
  180. package/dist/chunk-TA725QXR.mjs +0 -35
  181. package/dist/chunk-TXAOQHVV.mjs +0 -27
  182. package/dist/chunk-TZ2RKEBF.js +0 -2040
  183. package/dist/chunk-U7MLTDS4.js +0 -167
  184. package/dist/chunk-UIYW7U2O.js +0 -28
  185. package/dist/chunk-UP2JIDGZ.js +0 -81
  186. package/dist/chunk-USLYTOPD.mjs +0 -41
  187. package/dist/chunk-V2AWKRQI.js +0 -26
  188. package/dist/chunk-VE3Q5LC3.mjs +0 -26
  189. package/dist/chunk-VG6JYCUC.mjs +0 -74
  190. package/dist/chunk-VMSMHNPY.js +0 -48
  191. package/dist/chunk-VSZRD7CB.js +0 -33
  192. package/dist/chunk-VX2IFBCP.mjs +0 -17008
  193. package/dist/chunk-WLKNXHFN.mjs +0 -30
  194. package/dist/chunk-XGB3TDIC.mjs +0 -42
  195. package/dist/chunk-YXGKUR3R.js +0 -63
  196. package/dist/chunk-Z5BNMPTX.mjs +0 -81
  197. package/dist/chunk-ZQA42PYM.mjs +0 -67
  198. package/dist/chunk-ZSR4TJQG.js +0 -24
  199. package/dist/chunk-ZWLHVT5O.js +0 -41
  200. package/dist/color-BT6BF8oV.d.mts +0 -61
  201. package/dist/color-lBH29suB.d.ts +0 -61
  202. package/dist/commerce-BqVjXEhQ.d.mts +0 -40
  203. package/dist/commerce-mdOpchjx.d.ts +0 -40
  204. package/dist/common-IR_KozaJ.d.mts +0 -11
  205. package/dist/common-t-ZQebCq.d.ts +0 -11
  206. package/dist/company-C3EU1J7k.d.ts +0 -35
  207. package/dist/company-cR_0hm6U.d.mts +0 -35
  208. package/dist/config-BTjogu5M.d.ts +0 -7
  209. package/dist/config-C1N2Brw-.d.mts +0 -7
  210. package/dist/config.d.mts +0 -2
  211. package/dist/config_scheme.d.mts +0 -32
  212. package/dist/create_config.d.mts +0 -58
  213. package/dist/create_config.test.d.mts +0 -2
  214. package/dist/create_config.test.js +0 -63
  215. package/dist/create_config.test.mjs +0 -63
  216. package/dist/create_generator_fn.d.mts +0 -12
  217. package/dist/create_generator_fn.test.d.mts +0 -2
  218. package/dist/create_generator_fn.test.js +0 -191
  219. package/dist/create_generator_fn.test.mjs +0 -191
  220. package/dist/database-DV9wgnca.d.ts +0 -23
  221. package/dist/database-UzO1Lwec.d.mts +0 -23
  222. package/dist/datatype-C92TZLxo.d.ts +0 -13
  223. package/dist/datatype-DZjmP0fA.d.mts +0 -13
  224. package/dist/datetime-CSUpnUXU.d.ts +0 -78
  225. package/dist/datetime-dnPA_lnt.d.mts +0 -78
  226. package/dist/finance-CstKW1nH.d.mts +0 -90
  227. package/dist/finance-gj0fiEmf.d.ts +0 -90
  228. package/dist/food-CInj1GX2.d.ts +0 -35
  229. package/dist/food-Dk3-40CY.d.mts +0 -35
  230. package/dist/generator_fn-CJDbnCZl.d.mts +0 -7
  231. package/dist/generator_fn-D-npAfnC.d.ts +0 -7
  232. package/dist/generator_fn.d.mts +0 -2
  233. package/dist/git-BHL1ppL4.d.ts +0 -31
  234. package/dist/git-w0nznSjX.d.mts +0 -31
  235. package/dist/hacker-DL7pR6JO.d.ts +0 -26
  236. package/dist/hacker-FcQXZGtz.d.mts +0 -26
  237. package/dist/image-B5OPCNhD.d.mts +0 -56
  238. package/dist/image-IyGCgqNf.d.ts +0 -56
  239. package/dist/index.d.mts +0 -5
  240. package/dist/internet-BukCBMX-.d.ts +0 -106
  241. package/dist/internet-C2ElurWb.d.mts +0 -106
  242. package/dist/location-BIZ-KsaI.d.ts +0 -80
  243. package/dist/location-WU_nRdjx.d.mts +0 -80
  244. package/dist/lorem-OlHaVntu.d.mts +0 -62
  245. package/dist/lorem-yMyLb-d-.d.ts +0 -62
  246. package/dist/magic-string.es-2DLPM6Q3.js +0 -1299
  247. package/dist/magic-string.es-NHTKQXSF.mjs +0 -1299
  248. package/dist/music-P8XZ4JSO.d.ts +0 -20
  249. package/dist/music-vcWm9dzu.d.mts +0 -20
  250. package/dist/number-BfwwKvTJ.d.mts +0 -48
  251. package/dist/number-D5QmTRsK.d.ts +0 -48
  252. package/dist/person-DXne2mKX.d.ts +0 -58
  253. package/dist/person-Si_vy67g.d.mts +0 -58
  254. package/dist/phone-Cbxvm_Qv.d.ts +0 -16
  255. package/dist/phone-g4FDs50M.d.mts +0 -16
  256. package/dist/science-BX8WhoEY.d.ts +0 -15
  257. package/dist/science-BfA9sVXz.d.mts +0 -15
  258. package/dist/string-DGScZrrP.d.mts +0 -87
  259. package/dist/string-Do4vhsl0.d.ts +0 -87
  260. package/dist/system-BpxbduIr.d.ts +0 -55
  261. package/dist/system-Cy0e05Cr.d.mts +0 -55
  262. package/dist/test.d.mts +0 -2
  263. package/dist/test.d.ts +0 -2
  264. package/dist/test.js +0 -15
  265. package/dist/test.mjs +0 -15
  266. package/dist/type.d.mts +0 -93
  267. package/dist/utils/airline.d.mts +0 -3
  268. package/dist/utils/animal.d.mts +0 -2
  269. package/dist/utils/color.d.mts +0 -3
  270. package/dist/utils/commerce.d.mts +0 -2
  271. package/dist/utils/common.d.mts +0 -2
  272. package/dist/utils/company.d.mts +0 -2
  273. package/dist/utils/database.d.mts +0 -2
  274. package/dist/utils/datatype.d.mts +0 -2
  275. package/dist/utils/datetime.d.mts +0 -2
  276. package/dist/utils/finance.d.mts +0 -3
  277. package/dist/utils/food.d.mts +0 -2
  278. package/dist/utils/git.d.mts +0 -2
  279. package/dist/utils/hacker.d.mts +0 -2
  280. package/dist/utils/image.d.mts +0 -2
  281. package/dist/utils/index.d.mts +0 -28
  282. package/dist/utils/internet.d.mts +0 -3
  283. package/dist/utils/location.d.mts +0 -2
  284. package/dist/utils/lorem.d.mts +0 -2
  285. package/dist/utils/music.d.mts +0 -2
  286. package/dist/utils/number.d.mts +0 -2
  287. package/dist/utils/person.d.mts +0 -3
  288. package/dist/utils/phone.d.mts +0 -2
  289. package/dist/utils/science.d.mts +0 -3
  290. package/dist/utils/string.d.mts +0 -2
  291. package/dist/utils/system.d.mts +0 -2
  292. package/dist/utils/utils.d.mts +0 -2
  293. package/dist/utils/vehicle.d.mts +0 -2
  294. package/dist/utils/word.d.mts +0 -75
  295. package/dist/utils-BImnOpvp.d.ts +0 -10
  296. package/dist/utils-zJKwaMUY.d.mts +0 -10
  297. package/dist/vehicle-D4yBDYMc.d.mts +0 -35
  298. package/dist/vehicle-Ufz4AoXu.d.ts +0 -35
  299. package/src/test.ts +0 -10
  300. package/tsup.config.ts +0 -8
@@ -1,7 +0,0 @@
1
- import { createArrayConfig, createBoundedSeriesConfig, createObjectConfig, createSelectionConfig, createTupleConfig, createValueConfig } from './create_config.mjs';
2
-
3
- declare namespace config {
4
- export { createArrayConfig as array, createBoundedSeriesConfig as boundedSeries, createObjectConfig as object, createSelectionConfig as select, createTupleConfig as tuple, createValueConfig as value };
5
- }
6
-
7
- export { config as c };
package/dist/config.d.mts DELETED
@@ -1,2 +0,0 @@
1
- export { createArrayConfig as array, createBoundedSeriesConfig as boundedSeries, createObjectConfig as object, createSelectionConfig as select, createTupleConfig as tuple, createValueConfig as value } from './create_config.mjs';
2
- import './type.mjs';
@@ -1,32 +0,0 @@
1
- import { z } from 'zod/v4';
2
-
3
- declare const valueConfigScheme: z.ZodObject<{
4
- type: z.ZodString;
5
- generateFn: z.ZodAny;
6
- }, z.core.$strip>;
7
- declare const selectionConfigScheme: z.ZodObject<{
8
- type: z.ZodString;
9
- items: z.ZodArray<z.ZodAny>;
10
- }, z.core.$strip>;
11
- declare const arrayConfigScheme: z.ZodObject<{
12
- type: z.ZodString;
13
- item: z.ZodObject<{}, z.core.$strip>;
14
- len: z.ZodNumber;
15
- }, z.core.$strip>;
16
- declare const tupleConfigScheme: z.ZodObject<{
17
- type: z.ZodString;
18
- configItems: z.ZodArray<z.ZodAny>;
19
- }, z.core.$strip>;
20
- declare const objConfigScheme: z.ZodObject<{
21
- type: z.ZodString;
22
- content: z.ZodObject<{}, z.core.$strip>;
23
- }, z.core.$strip>;
24
- declare const boundedSeriesScheme: z.ZodObject<{
25
- type: z.ZodString;
26
- upperLimit: z.ZodNumber;
27
- lowerLimit: z.ZodNumber;
28
- createInitValue: z.ZodAny;
29
- count: z.ZodNumber;
30
- }, z.core.$strip>;
31
-
32
- export { arrayConfigScheme, boundedSeriesScheme, objConfigScheme, selectionConfigScheme, tupleConfigScheme, valueConfigScheme };
@@ -1,58 +0,0 @@
1
- import { ValueConfig, Result, ArrayConfig, ObjectConfig, ObjectConfigWithFn, TupleConfig, SelectionConfig, BoundedSeriesConfig } from './type.mjs';
2
-
3
- /**
4
- * value
5
- * @param {function} generateFn - The function used to generate the value.
6
- * @return {ValueConfig} The configuration object with the type "value" and the provided generate function.
7
- */
8
- declare const createValueConfig: <T>(generateFn: () => T) => ValueConfig<T>;
9
- /**
10
- * selection
11
- * @param {Array} items - The array of items to choose from.
12
- * @return {SelectionConfig} The configuration object with the type "select" and the provided items.
13
- */
14
- declare const createSelectionConfig: <T>(items: T[]) => SelectionConfig<T>;
15
- /**
16
- * object
17
- * @param {object} content
18
- * @param {function} transformer
19
- * @return {ObjectConfig}
20
- */
21
- declare function createObjectConfig<T extends object>(content: T): ObjectConfig<T>;
22
- declare function createObjectConfig<T extends object, R>(content: T, transformer: (v: {
23
- [K in keyof T]: Result<T[K]>;
24
- }) => R): ObjectConfigWithFn<T, R>;
25
- /**
26
- * array
27
- * @param {object} item
28
- * @param {number} len
29
- * @param {function} next
30
- * @return {ArrayConfig}
31
- */
32
- declare const createArrayConfig: <T>(item: T, len: number, next?: (v: Result<T>) => Result<T>) => ArrayConfig<T>;
33
- /**
34
- * tuple
35
- * @param {Array} configItems
36
- * @return {TupleConfig}
37
- */
38
- interface CreateTupleConfig {
39
- <A, B, C, D, E, F, G, H, I, J>(configItems: [A, B, C, D, E, F, G, H, I, J]): TupleConfig<A, B, C, D, E, F, G, H, I, J>;
40
- <A, B, C, D, E, F, G, H, I>(configItems: [A, B, C, D, E, F, G, H, I]): TupleConfig<A, B, C, D, E, F, G, H, I>;
41
- <A, B, C, D, E, F, G, H>(configItems: [A, B, C, D, E, F, G, H]): TupleConfig<A, B, C, D, E, F, G, H>;
42
- <A, B, C, D, E, F, G>(configItems: [A, B, C, D, E, F, G]): TupleConfig<A, B, C, D, E, F, G>;
43
- <A, B, C, D, E, F>(configItems: [A, B, C, D, E, F]): TupleConfig<A, B, C, D, E, F>;
44
- <A, B, C, D, E>(configItems: [A, B, C, D, E]): TupleConfig<A, B, C, D, E>;
45
- <A, B, C, D>(configItems: [A, B, C, D]): TupleConfig<A, B, C, D>;
46
- <A, B, C>(configItems: [A, B, C]): TupleConfig<A, B, C>;
47
- <A, B>(configItems: [A, B]): TupleConfig<A, B>;
48
- <A>(configItems: [A]): TupleConfig<A>;
49
- }
50
- declare const createTupleConfig: CreateTupleConfig;
51
- /**
52
- * bounded series
53
- * @param {{ upperLimit: number, lowerLimit: number, createInitValue: () => number, count: number }} config
54
- * @return {BoundedSeriesConfig}
55
- */
56
- declare const createBoundedSeriesConfig: (config: Omit<BoundedSeriesConfig, "type">) => BoundedSeriesConfig;
57
-
58
- export { createArrayConfig, createBoundedSeriesConfig, createObjectConfig, createSelectionConfig, createTupleConfig, createValueConfig };
@@ -1,2 +0,0 @@
1
-
2
- export { }
@@ -1,63 +0,0 @@
1
- "use strict";
2
-
3
-
4
- var _chunkDM5VFX6Bjs = require('./chunk-DM5VFX6B.js');
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
- var _chunkC3RGM3CBjs = require('./chunk-C3RGM3CB.js');
13
- require('./chunk-ZWLHVT5O.js');
14
- require('./chunk-4VNS5WPM.js');
15
-
16
- // src/create_config.test.ts
17
- _chunkDM5VFX6Bjs.test.call(void 0, "createValueConfig", () => {
18
- const valueConfig = _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => 44);
19
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, valueConfig.type).toBe("value");
20
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, valueConfig.generateFn).toBeTypeOf("function");
21
- });
22
- _chunkDM5VFX6Bjs.test.call(void 0, "createSelectionConfig", () => {
23
- const options = [1, 2, 3, 4];
24
- const selectionConfig = _chunkC3RGM3CBjs.createSelectionConfig.call(void 0, [1, 2, 3, 4]);
25
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, selectionConfig.type).toBe("select");
26
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, selectionConfig.items).toEqual(options);
27
- });
28
- _chunkDM5VFX6Bjs.test.call(void 0, "createArrayConfig", () => {
29
- const valueConfig = _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => 44);
30
- const arrConfig = _chunkC3RGM3CBjs.createArrayConfig.call(void 0, valueConfig, 20);
31
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, arrConfig.type).toBe("arr");
32
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, arrConfig.len).toBe(20);
33
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, arrConfig.item).toEqual(valueConfig);
34
- });
35
- _chunkDM5VFX6Bjs.test.call(void 0, "createTupleConfig", () => {
36
- const value1Config = _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => 123);
37
- const value2Config = _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => "hello");
38
- const tupleConfig = _chunkC3RGM3CBjs.createTupleConfig.call(void 0, [value1Config, value2Config]);
39
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, tupleConfig.type).toBe("tuple");
40
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, tupleConfig.configItems).toEqual([value1Config, value2Config]);
41
- });
42
- _chunkDM5VFX6Bjs.test.call(void 0, "createObjConfig", () => {
43
- const value1Config = _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => 32);
44
- const value2Config = _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => "frank");
45
- const objConfig = _chunkC3RGM3CBjs.createObjectConfig.call(void 0, {
46
- name: value2Config,
47
- age: value1Config
48
- });
49
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, objConfig.type).toBe("obj");
50
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, objConfig.content).toEqual({ name: value2Config, age: value1Config });
51
- });
52
- _chunkDM5VFX6Bjs.test.call(void 0, "createBoundedSeriesConfig", () => {
53
- const boundedSeriesConfig = _chunkC3RGM3CBjs.createBoundedSeriesConfig.call(void 0, {
54
- count: 1,
55
- upperLimit: 1.2,
56
- lowerLimit: 1,
57
- createInitValue: () => 40
58
- });
59
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, boundedSeriesConfig.type).toBe("bounded_series");
60
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, boundedSeriesConfig.upperLimit).toBe(1.2);
61
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, boundedSeriesConfig.lowerLimit).toBe(1);
62
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, boundedSeriesConfig.createInitValue).toBeTypeOf("function");
63
- });
@@ -1,63 +0,0 @@
1
- import {
2
- globalExpect,
3
- test
4
- } from "./chunk-VX2IFBCP.mjs";
5
- import {
6
- createArrayConfig,
7
- createBoundedSeriesConfig,
8
- createObjectConfig,
9
- createSelectionConfig,
10
- createTupleConfig,
11
- createValueConfig
12
- } from "./chunk-ZQA42PYM.mjs";
13
- import "./chunk-USLYTOPD.mjs";
14
- import "./chunk-XGB3TDIC.mjs";
15
-
16
- // src/create_config.test.ts
17
- test("createValueConfig", () => {
18
- const valueConfig = createValueConfig(() => 44);
19
- globalExpect(valueConfig.type).toBe("value");
20
- globalExpect(valueConfig.generateFn).toBeTypeOf("function");
21
- });
22
- test("createSelectionConfig", () => {
23
- const options = [1, 2, 3, 4];
24
- const selectionConfig = createSelectionConfig([1, 2, 3, 4]);
25
- globalExpect(selectionConfig.type).toBe("select");
26
- globalExpect(selectionConfig.items).toEqual(options);
27
- });
28
- test("createArrayConfig", () => {
29
- const valueConfig = createValueConfig(() => 44);
30
- const arrConfig = createArrayConfig(valueConfig, 20);
31
- globalExpect(arrConfig.type).toBe("arr");
32
- globalExpect(arrConfig.len).toBe(20);
33
- globalExpect(arrConfig.item).toEqual(valueConfig);
34
- });
35
- test("createTupleConfig", () => {
36
- const value1Config = createValueConfig(() => 123);
37
- const value2Config = createValueConfig(() => "hello");
38
- const tupleConfig = createTupleConfig([value1Config, value2Config]);
39
- globalExpect(tupleConfig.type).toBe("tuple");
40
- globalExpect(tupleConfig.configItems).toEqual([value1Config, value2Config]);
41
- });
42
- test("createObjConfig", () => {
43
- const value1Config = createValueConfig(() => 32);
44
- const value2Config = createValueConfig(() => "frank");
45
- const objConfig = createObjectConfig({
46
- name: value2Config,
47
- age: value1Config
48
- });
49
- globalExpect(objConfig.type).toBe("obj");
50
- globalExpect(objConfig.content).toEqual({ name: value2Config, age: value1Config });
51
- });
52
- test("createBoundedSeriesConfig", () => {
53
- const boundedSeriesConfig = createBoundedSeriesConfig({
54
- count: 1,
55
- upperLimit: 1.2,
56
- lowerLimit: 1,
57
- createInitValue: () => 40
58
- });
59
- globalExpect(boundedSeriesConfig.type).toBe("bounded_series");
60
- globalExpect(boundedSeriesConfig.upperLimit).toBe(1.2);
61
- globalExpect(boundedSeriesConfig.lowerLimit).toBe(1);
62
- globalExpect(boundedSeriesConfig.createInitValue).toBeTypeOf("function");
63
- });
@@ -1,12 +0,0 @@
1
- import { ValueConfig, SelectionConfig, Result, ObjectConfig, ArrayConfig, TupleConfig, BoundedSeriesConfig, ObjectConfigWithFn } from './type.mjs';
2
-
3
- type AllConfig<T> = ValueConfig<T> | SelectionConfig<T> | ArrayConfig<T> | ObjectConfig<T> | ObjectConfigWithFn<T, unknown> | TupleConfig<T> | TupleConfig<T, T> | TupleConfig<T, T, T> | TupleConfig<T, T, T, T> | TupleConfig<T, T, T, T, T> | TupleConfig<T, T, T, T, T, T> | TupleConfig<T, T, T, T, T, T, T> | TupleConfig<T, T, T, T, T, T, T, T> | TupleConfig<T, T, T, T, T, T, T, T, T> | TupleConfig<T, T, T, T, T, T, T, T, T, T> | BoundedSeriesConfig;
4
- declare const createValueGenerator: <R = unknown>(config: ValueConfig<unknown>) => (() => R);
5
- declare const createSelectionGenerator: <T extends SelectionConfig<unknown>>(config: T) => (() => Result<T>);
6
- declare const createObjectGenerator: <T extends ObjectConfig<unknown>>(config: T, customTypeMatch?: (config: unknown, path?: string) => ValueConfig<unknown>) => (() => Result<T>);
7
- declare const createArrayGenerator: <T extends ArrayConfig<unknown>>(config: T, customTypeMatch?: (config: unknown, path?: string) => ValueConfig<unknown>) => (() => Result<T>);
8
- declare const createTupleGenerator: <T extends TupleConfig<unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown> | TupleConfig<unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown> | TupleConfig<unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown> | TupleConfig<unknown, unknown, unknown, unknown, unknown, unknown> | TupleConfig<unknown, unknown, unknown, unknown, unknown> | TupleConfig<unknown, unknown, unknown, unknown> | TupleConfig<unknown, unknown, unknown> | TupleConfig<unknown, unknown> | TupleConfig<unknown>>(config: T, customTypeMatch?: (config: unknown, path: string) => ValueConfig<unknown>) => (() => Result<T>);
9
- declare const createBoundedSeriesGenerator: <T extends BoundedSeriesConfig>(config: T) => (() => Result<T>);
10
- declare const createGeneratorByType: <T extends AllConfig<unknown>>(config: T, customTypeMatch?: (config: unknown, path: string) => ValueConfig<unknown>) => (() => Result<T>);
11
-
12
- export { createArrayGenerator, createBoundedSeriesGenerator, createGeneratorByType, createObjectGenerator, createSelectionGenerator, createTupleGenerator, createValueGenerator };
@@ -1,2 +0,0 @@
1
-
2
- export { }
@@ -1,191 +0,0 @@
1
- "use strict";
2
-
3
-
4
-
5
- var _chunkDM5VFX6Bjs = require('./chunk-DM5VFX6B.js');
6
-
7
-
8
-
9
-
10
-
11
- var _chunkC3RGM3CBjs = require('./chunk-C3RGM3CB.js');
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
- var _chunkU7MLTDS4js = require('./chunk-U7MLTDS4.js');
21
- require('./chunk-TZ2RKEBF.js');
22
- require('./chunk-ZWLHVT5O.js');
23
- require('./chunk-4VNS5WPM.js');
24
-
25
- // src/create_generator_fn.test.ts
26
- _chunkDM5VFX6Bjs.describe.call(void 0, "createValueGenerator", () => {
27
- _chunkDM5VFX6Bjs.test.call(void 0, "normal", () => {
28
- const value = _chunkU7MLTDS4js.createValueGenerator.call(void 0, {
29
- type: "value",
30
- generateFn: () => 50
31
- })();
32
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, value).toBe(50);
33
- const value2 = _chunkU7MLTDS4js.createValueGenerator.call(void 0, {
34
- type: "value",
35
- generateFn: () => ({ age: 100, name: "hello" })
36
- })();
37
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, value2).toEqual({ age: 100, name: "hello" });
38
- });
39
- });
40
- _chunkDM5VFX6Bjs.describe.call(void 0, "createSelectionGenerator", () => {
41
- _chunkDM5VFX6Bjs.test.call(void 0, "normal", () => {
42
- const value = _chunkU7MLTDS4js.createSelectionGenerator.call(void 0, {
43
- type: "select",
44
- items: [1]
45
- })();
46
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, value).toBe(1);
47
- const value2 = _chunkU7MLTDS4js.createSelectionGenerator.call(void 0, {
48
- type: "select",
49
- items: [30, 30, 30, 30]
50
- })();
51
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, value2).toBe(30);
52
- });
53
- });
54
- _chunkDM5VFX6Bjs.describe.call(void 0, "createArrayGenerator", () => {
55
- _chunkDM5VFX6Bjs.test.call(void 0, "normal", () => {
56
- const list = _chunkU7MLTDS4js.createArrayGenerator.call(void 0, {
57
- type: "arr",
58
- len: 5,
59
- item: { type: "value", generateFn: () => ({ age: 42 }) }
60
- })();
61
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, list).toEqual([
62
- { age: 42 },
63
- { age: 42 },
64
- { age: 42 },
65
- { age: 42 },
66
- { age: 42 }
67
- ]);
68
- });
69
- });
70
- _chunkDM5VFX6Bjs.describe.call(void 0, "createTupleGenerator", () => {
71
- _chunkDM5VFX6Bjs.test.call(void 0, "normal", () => {
72
- const tuple = _chunkU7MLTDS4js.createTupleGenerator.call(void 0,
73
- _chunkC3RGM3CBjs.createTupleConfig.call(void 0, [
74
- _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => 225),
75
- _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => "hello world")
76
- ])
77
- )();
78
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, tuple.length).toBe(2);
79
- const [num, str] = tuple;
80
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, num).toBe(225);
81
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, str).toBe("hello world");
82
- });
83
- });
84
- _chunkDM5VFX6Bjs.describe.call(void 0, "createObjectGenerator", () => {
85
- _chunkDM5VFX6Bjs.test.call(void 0, "normal", () => {
86
- const obj = _chunkU7MLTDS4js.createObjectGenerator.call(void 0, {
87
- type: "obj",
88
- content: {
89
- name: { type: "value", generateFn: () => "John" },
90
- age: { type: "value", generateFn: () => 50 },
91
- location: { type: "value", generateFn: () => "Taiwan" }
92
- }
93
- })();
94
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, obj).toEqual({ name: "John", age: 50, location: "Taiwan" });
95
- });
96
- _chunkDM5VFX6Bjs.test.call(void 0, "transformer function", () => {
97
- const obj = _chunkU7MLTDS4js.createObjectGenerator.call(void 0,
98
- _chunkC3RGM3CBjs.createObjectConfig.call(void 0,
99
- {
100
- name: _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => "John"),
101
- age: _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => 50),
102
- location: _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => "Taiwan")
103
- },
104
- ({ age }) => age + 50
105
- )
106
- )();
107
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, obj).toEqual(100);
108
- });
109
- });
110
- _chunkDM5VFX6Bjs.describe.call(void 0, "createBoundedSeriesGenerator", () => {
111
- _chunkDM5VFX6Bjs.test.call(void 0, "normal", () => {
112
- const upperLimit = 1.1;
113
- const lowerLimit = 0.9;
114
- const initValue = 100;
115
- const count = 100;
116
- const list = _chunkU7MLTDS4js.createBoundedSeriesGenerator.call(void 0, {
117
- type: "bounded_series",
118
- upperLimit,
119
- lowerLimit,
120
- createInitValue: () => initValue,
121
- count
122
- })();
123
- for (let i = 0; i < count; i++) {
124
- const value = list[i];
125
- if (i === 0) {
126
- const ratio2 = value / initValue;
127
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, ratio2).toBeLessThanOrEqual(upperLimit);
128
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, ratio2).toBeGreaterThanOrEqual(lowerLimit);
129
- continue;
130
- }
131
- const prevValue = list[i - 1];
132
- const ratio = value / prevValue;
133
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, ratio).toBeLessThanOrEqual(upperLimit);
134
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, ratio).toBeGreaterThanOrEqual(lowerLimit);
135
- }
136
- });
137
- });
138
- _chunkDM5VFX6Bjs.describe.call(void 0, "createGeneratorByType", () => {
139
- _chunkDM5VFX6Bjs.test.call(void 0, "normal", () => {
140
- const config = _chunkC3RGM3CBjs.createObjectConfig.call(void 0, {
141
- name: _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => "John"),
142
- age: _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => 50),
143
- locations: _chunkC3RGM3CBjs.createArrayConfig.call(void 0,
144
- _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => "Taiwan"),
145
- 5
146
- )
147
- });
148
- const result = _chunkU7MLTDS4js.createGeneratorByType.call(void 0, config)();
149
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, result).toEqual({
150
- name: "John",
151
- age: 50,
152
- locations: ["Taiwan", "Taiwan", "Taiwan", "Taiwan", "Taiwan"]
153
- });
154
- });
155
- _chunkDM5VFX6Bjs.test.call(void 0, "test error config", () => {
156
- const config = {
157
- type: "obj",
158
- content: {
159
- name: {
160
- type: "123",
161
- generateFn: "John"
162
- }
163
- }
164
- };
165
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, () => _chunkU7MLTDS4js.createGeneratorByType.call(void 0, config)).toThrowError();
166
- });
167
- _chunkDM5VFX6Bjs.test.call(void 0, "with custom type match", () => {
168
- const createIntValueConfig = (option) => _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => 50);
169
- const createEmailValueConfig = (option) => _chunkC3RGM3CBjs.createValueConfig.call(void 0, () => "xxx@example.com");
170
- const customTypeMatch = (config2) => {
171
- if (config2.type === "int") {
172
- return createIntValueConfig(config2.option);
173
- }
174
- if (config2.type === "email") {
175
- return createEmailValueConfig(config2.option);
176
- }
177
- throw Error("error");
178
- };
179
- const config = _chunkC3RGM3CBjs.createObjectConfig.call(void 0, {
180
- name: { type: "value", generateFn: () => "John" },
181
- age: { type: "int" },
182
- email: { type: "email" }
183
- });
184
- const result = _chunkU7MLTDS4js.createGeneratorByType.call(void 0, config, customTypeMatch)();
185
- _chunkDM5VFX6Bjs.globalExpect.call(void 0, result).toEqual({
186
- name: "John",
187
- age: 50,
188
- email: "xxx@example.com"
189
- });
190
- });
191
- });
@@ -1,191 +0,0 @@
1
- import {
2
- describe,
3
- globalExpect,
4
- test
5
- } from "./chunk-VX2IFBCP.mjs";
6
- import {
7
- createArrayConfig,
8
- createObjectConfig,
9
- createTupleConfig,
10
- createValueConfig
11
- } from "./chunk-ZQA42PYM.mjs";
12
- import {
13
- createArrayGenerator,
14
- createBoundedSeriesGenerator,
15
- createGeneratorByType,
16
- createObjectGenerator,
17
- createSelectionGenerator,
18
- createTupleGenerator,
19
- createValueGenerator
20
- } from "./chunk-MLJAHDYX.mjs";
21
- import "./chunk-3U6BNHWG.mjs";
22
- import "./chunk-USLYTOPD.mjs";
23
- import "./chunk-XGB3TDIC.mjs";
24
-
25
- // src/create_generator_fn.test.ts
26
- describe("createValueGenerator", () => {
27
- test("normal", () => {
28
- const value = createValueGenerator({
29
- type: "value",
30
- generateFn: () => 50
31
- })();
32
- globalExpect(value).toBe(50);
33
- const value2 = createValueGenerator({
34
- type: "value",
35
- generateFn: () => ({ age: 100, name: "hello" })
36
- })();
37
- globalExpect(value2).toEqual({ age: 100, name: "hello" });
38
- });
39
- });
40
- describe("createSelectionGenerator", () => {
41
- test("normal", () => {
42
- const value = createSelectionGenerator({
43
- type: "select",
44
- items: [1]
45
- })();
46
- globalExpect(value).toBe(1);
47
- const value2 = createSelectionGenerator({
48
- type: "select",
49
- items: [30, 30, 30, 30]
50
- })();
51
- globalExpect(value2).toBe(30);
52
- });
53
- });
54
- describe("createArrayGenerator", () => {
55
- test("normal", () => {
56
- const list = createArrayGenerator({
57
- type: "arr",
58
- len: 5,
59
- item: { type: "value", generateFn: () => ({ age: 42 }) }
60
- })();
61
- globalExpect(list).toEqual([
62
- { age: 42 },
63
- { age: 42 },
64
- { age: 42 },
65
- { age: 42 },
66
- { age: 42 }
67
- ]);
68
- });
69
- });
70
- describe("createTupleGenerator", () => {
71
- test("normal", () => {
72
- const tuple = createTupleGenerator(
73
- createTupleConfig([
74
- createValueConfig(() => 225),
75
- createValueConfig(() => "hello world")
76
- ])
77
- )();
78
- globalExpect(tuple.length).toBe(2);
79
- const [num, str] = tuple;
80
- globalExpect(num).toBe(225);
81
- globalExpect(str).toBe("hello world");
82
- });
83
- });
84
- describe("createObjectGenerator", () => {
85
- test("normal", () => {
86
- const obj = createObjectGenerator({
87
- type: "obj",
88
- content: {
89
- name: { type: "value", generateFn: () => "John" },
90
- age: { type: "value", generateFn: () => 50 },
91
- location: { type: "value", generateFn: () => "Taiwan" }
92
- }
93
- })();
94
- globalExpect(obj).toEqual({ name: "John", age: 50, location: "Taiwan" });
95
- });
96
- test("transformer function", () => {
97
- const obj = createObjectGenerator(
98
- createObjectConfig(
99
- {
100
- name: createValueConfig(() => "John"),
101
- age: createValueConfig(() => 50),
102
- location: createValueConfig(() => "Taiwan")
103
- },
104
- ({ age }) => age + 50
105
- )
106
- )();
107
- globalExpect(obj).toEqual(100);
108
- });
109
- });
110
- describe("createBoundedSeriesGenerator", () => {
111
- test("normal", () => {
112
- const upperLimit = 1.1;
113
- const lowerLimit = 0.9;
114
- const initValue = 100;
115
- const count = 100;
116
- const list = createBoundedSeriesGenerator({
117
- type: "bounded_series",
118
- upperLimit,
119
- lowerLimit,
120
- createInitValue: () => initValue,
121
- count
122
- })();
123
- for (let i = 0; i < count; i++) {
124
- const value = list[i];
125
- if (i === 0) {
126
- const ratio2 = value / initValue;
127
- globalExpect(ratio2).toBeLessThanOrEqual(upperLimit);
128
- globalExpect(ratio2).toBeGreaterThanOrEqual(lowerLimit);
129
- continue;
130
- }
131
- const prevValue = list[i - 1];
132
- const ratio = value / prevValue;
133
- globalExpect(ratio).toBeLessThanOrEqual(upperLimit);
134
- globalExpect(ratio).toBeGreaterThanOrEqual(lowerLimit);
135
- }
136
- });
137
- });
138
- describe("createGeneratorByType", () => {
139
- test("normal", () => {
140
- const config = createObjectConfig({
141
- name: createValueConfig(() => "John"),
142
- age: createValueConfig(() => 50),
143
- locations: createArrayConfig(
144
- createValueConfig(() => "Taiwan"),
145
- 5
146
- )
147
- });
148
- const result = createGeneratorByType(config)();
149
- globalExpect(result).toEqual({
150
- name: "John",
151
- age: 50,
152
- locations: ["Taiwan", "Taiwan", "Taiwan", "Taiwan", "Taiwan"]
153
- });
154
- });
155
- test("test error config", () => {
156
- const config = {
157
- type: "obj",
158
- content: {
159
- name: {
160
- type: "123",
161
- generateFn: "John"
162
- }
163
- }
164
- };
165
- globalExpect(() => createGeneratorByType(config)).toThrowError();
166
- });
167
- test("with custom type match", () => {
168
- const createIntValueConfig = (option) => createValueConfig(() => 50);
169
- const createEmailValueConfig = (option) => createValueConfig(() => "xxx@example.com");
170
- const customTypeMatch = (config2) => {
171
- if (config2.type === "int") {
172
- return createIntValueConfig(config2.option);
173
- }
174
- if (config2.type === "email") {
175
- return createEmailValueConfig(config2.option);
176
- }
177
- throw Error("error");
178
- };
179
- const config = createObjectConfig({
180
- name: { type: "value", generateFn: () => "John" },
181
- age: { type: "int" },
182
- email: { type: "email" }
183
- });
184
- const result = createGeneratorByType(config, customTypeMatch)();
185
- globalExpect(result).toEqual({
186
- name: "John",
187
- age: 50,
188
- email: "xxx@example.com"
189
- });
190
- });
191
- });
@@ -1,23 +0,0 @@
1
- import { ValueConfig } from './type.js';
2
-
3
- /** Database [collation](https://fakerjs.dev/api/database.html#collation) */
4
- declare const collation: () => ValueConfig<string>;
5
- /** Database [column](https://fakerjs.dev/api/database.html#column) */
6
- declare const column: () => ValueConfig<string>;
7
- /** Database [engine](https://fakerjs.dev/api/database.html#engine) */
8
- declare const engine: () => ValueConfig<string>;
9
- /** Database [mongodbObjectId](https://fakerjs.dev/api/database.html#mongodbObjectId) */
10
- declare const mongodbObjectId: () => ValueConfig<string>;
11
- /** Database [type](https://fakerjs.dev/api/database.html#type) */
12
- declare const type: () => ValueConfig<string>;
13
-
14
- declare const database_collation: typeof collation;
15
- declare const database_column: typeof column;
16
- declare const database_engine: typeof engine;
17
- declare const database_mongodbObjectId: typeof mongodbObjectId;
18
- declare const database_type: typeof type;
19
- declare namespace database {
20
- export { database_collation as collation, database_column as column, database_engine as engine, database_mongodbObjectId as mongodbObjectId, database_type as type };
21
- }
22
-
23
- export { column as a, collation as c, database as d, engine as e, mongodbObjectId as m, type as t };