@vielzeug/illusionist 2.3.2 → 26.10.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 (159) hide show
  1. package/README.md +2 -50
  2. package/dist/_helpers/boolean.cjs +1 -1
  3. package/dist/_helpers/boolean.cjs.map +1 -1
  4. package/dist/_helpers/boolean.d.ts +1 -1
  5. package/dist/_helpers/boolean.d.ts.map +1 -1
  6. package/dist/_helpers/boolean.js +1 -8
  7. package/dist/_helpers/boolean.js.map +1 -1
  8. package/dist/_helpers/float.cjs +1 -1
  9. package/dist/_helpers/float.cjs.map +1 -1
  10. package/dist/_helpers/float.d.ts +1 -1
  11. package/dist/_helpers/float.d.ts.map +1 -1
  12. package/dist/_helpers/float.js +1 -12
  13. package/dist/_helpers/float.js.map +1 -1
  14. package/dist/_helpers/int.cjs +1 -1
  15. package/dist/_helpers/int.cjs.map +1 -1
  16. package/dist/_helpers/int.d.ts +1 -1
  17. package/dist/_helpers/int.d.ts.map +1 -1
  18. package/dist/_helpers/int.js +1 -8
  19. package/dist/_helpers/int.js.map +1 -1
  20. package/dist/_helpers/next-float.d.ts +1 -3
  21. package/dist/_helpers/next-float.d.ts.map +1 -1
  22. package/dist/_helpers/next-float.js +1 -8
  23. package/dist/_helpers/string.cjs +1 -1
  24. package/dist/_helpers/string.cjs.map +1 -1
  25. package/dist/_helpers/string.d.ts +1 -1
  26. package/dist/_helpers/string.d.ts.map +1 -1
  27. package/dist/_helpers/string.js +1 -28
  28. package/dist/_helpers/string.js.map +1 -1
  29. package/dist/_virtual/_rolldown/runtime.cjs +1 -1
  30. package/dist/_virtual/_rolldown/runtime.js +1 -11
  31. package/dist/commerce/commerce.cjs +1 -1
  32. package/dist/commerce/commerce.cjs.map +1 -1
  33. package/dist/commerce/commerce.js +1 -50
  34. package/dist/commerce/commerce.js.map +1 -1
  35. package/dist/commerce/data.js +1 -82
  36. package/dist/commerce/data.js.map +1 -1
  37. package/dist/date/date.cjs +1 -1
  38. package/dist/date/date.cjs.map +1 -1
  39. package/dist/date/date.d.ts.map +1 -1
  40. package/dist/date/date.js +1 -92
  41. package/dist/date/date.js.map +1 -1
  42. package/dist/errors.cjs +1 -1
  43. package/dist/errors.cjs.map +1 -1
  44. package/dist/errors.js +1 -9
  45. package/dist/errors.js.map +1 -1
  46. package/dist/factory.cjs +1 -1
  47. package/dist/factory.cjs.map +1 -1
  48. package/dist/factory.d.ts +0 -5
  49. package/dist/factory.d.ts.map +1 -1
  50. package/dist/factory.js +1 -45
  51. package/dist/factory.js.map +1 -1
  52. package/dist/finance/data.js +1 -59
  53. package/dist/finance/data.js.map +1 -1
  54. package/dist/finance/finance.cjs +1 -1
  55. package/dist/finance/finance.cjs.map +1 -1
  56. package/dist/finance/finance.js +1 -89
  57. package/dist/finance/finance.js.map +1 -1
  58. package/dist/illusionist.cjs +3 -3
  59. package/dist/illusionist.cjs.map +1 -1
  60. package/dist/illusionist.iife.js +3 -3
  61. package/dist/illusionist.iife.js.map +1 -1
  62. package/dist/illusionist.js +3 -3
  63. package/dist/illusionist.js.map +1 -1
  64. package/dist/index.cjs +1 -1
  65. package/dist/index.js +1 -12
  66. package/dist/internet/data.js +1 -83
  67. package/dist/internet/data.js.map +1 -1
  68. package/dist/internet/internet.cjs +1 -1
  69. package/dist/internet/internet.cjs.map +1 -1
  70. package/dist/internet/internet.js +1 -120
  71. package/dist/internet/internet.js.map +1 -1
  72. package/dist/locales/de.js +1 -11
  73. package/dist/locales/de.js.map +1 -1
  74. package/dist/locales/en.js +1 -11
  75. package/dist/locales/en.js.map +1 -1
  76. package/dist/locales/index.js +1 -3
  77. package/dist/location/data/de.js +1 -81
  78. package/dist/location/data/de.js.map +1 -1
  79. package/dist/location/data/en.js +1 -64
  80. package/dist/location/data/en.js.map +1 -1
  81. package/dist/location/location.cjs +1 -1
  82. package/dist/location/location.cjs.map +1 -1
  83. package/dist/location/location.js +1 -56
  84. package/dist/location/location.js.map +1 -1
  85. package/dist/lorem/data.js +1 -5
  86. package/dist/lorem/data.js.map +1 -1
  87. package/dist/lorem/lorem.cjs +3 -3
  88. package/dist/lorem/lorem.cjs.map +1 -1
  89. package/dist/lorem/lorem.js +3 -53
  90. package/dist/lorem/lorem.js.map +1 -1
  91. package/dist/person/data/de.js +1 -61
  92. package/dist/person/data/de.js.map +1 -1
  93. package/dist/person/data/en.js +1 -69
  94. package/dist/person/data/en.js.map +1 -1
  95. package/dist/person/person.cjs +1 -1
  96. package/dist/person/person.cjs.map +1 -1
  97. package/dist/person/person.js +1 -43
  98. package/dist/person/person.js.map +1 -1
  99. package/dist/seed/create-seed.cjs +1 -1
  100. package/dist/seed/create-seed.cjs.map +1 -1
  101. package/dist/seed/create-seed.d.ts +2 -2
  102. package/dist/seed/create-seed.d.ts.map +1 -1
  103. package/dist/seed/create-seed.js +1 -22
  104. package/dist/seed/create-seed.js.map +1 -1
  105. package/dist/seed/mulberry32.cjs +1 -1
  106. package/dist/seed/mulberry32.cjs.map +1 -1
  107. package/dist/seed/mulberry32.d.ts +1 -1
  108. package/dist/seed/mulberry32.d.ts.map +1 -1
  109. package/dist/seed/mulberry32.js +1 -12
  110. package/dist/seed/mulberry32.js.map +1 -1
  111. package/dist/system/data.js +1 -75
  112. package/dist/system/data.js.map +1 -1
  113. package/dist/system/system.cjs +1 -1
  114. package/dist/system/system.cjs.map +1 -1
  115. package/dist/system/system.d.ts.map +1 -1
  116. package/dist/system/system.js +1 -69
  117. package/dist/system/system.js.map +1 -1
  118. package/dist/types.d.ts +2 -3
  119. package/dist/types.d.ts.map +1 -1
  120. package/package.json +10 -82
  121. package/dist/_helpers/next-float.cjs +0 -2
  122. package/dist/_helpers/next-float.cjs.map +0 -1
  123. package/dist/_helpers/next-float.js.map +0 -1
  124. package/dist/commerce/index.cjs +0 -1
  125. package/dist/commerce/index.d.ts +0 -2
  126. package/dist/commerce/index.d.ts.map +0 -1
  127. package/dist/commerce/index.js +0 -2
  128. package/dist/date/index.cjs +0 -1
  129. package/dist/date/index.d.ts +0 -2
  130. package/dist/date/index.d.ts.map +0 -1
  131. package/dist/date/index.js +0 -2
  132. package/dist/finance/index.cjs +0 -1
  133. package/dist/finance/index.d.ts +0 -2
  134. package/dist/finance/index.d.ts.map +0 -1
  135. package/dist/finance/index.js +0 -2
  136. package/dist/internet/index.cjs +0 -1
  137. package/dist/internet/index.d.ts +0 -2
  138. package/dist/internet/index.d.ts.map +0 -1
  139. package/dist/internet/index.js +0 -2
  140. package/dist/location/index.cjs +0 -1
  141. package/dist/location/index.d.ts +0 -2
  142. package/dist/location/index.d.ts.map +0 -1
  143. package/dist/location/index.js +0 -2
  144. package/dist/lorem/index.cjs +0 -1
  145. package/dist/lorem/index.d.ts +0 -2
  146. package/dist/lorem/index.d.ts.map +0 -1
  147. package/dist/lorem/index.js +0 -2
  148. package/dist/person/index.cjs +0 -1
  149. package/dist/person/index.d.ts +0 -2
  150. package/dist/person/index.d.ts.map +0 -1
  151. package/dist/person/index.js +0 -2
  152. package/dist/seed/index.cjs +0 -1
  153. package/dist/seed/index.d.ts +0 -3
  154. package/dist/seed/index.d.ts.map +0 -1
  155. package/dist/seed/index.js +0 -3
  156. package/dist/system/index.cjs +0 -1
  157. package/dist/system/index.d.ts +0 -2
  158. package/dist/system/index.d.ts.map +0 -1
  159. package/dist/system/index.js +0 -2
package/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # @vielzeug/illusionist
2
2
 
3
- > Typed, deterministic, locale-aware fake data generator with seeded PRNG.
4
-
5
- [![npm version](https://img.shields.io/npm/v/@vielzeug/illusionist)](https://www.npmjs.com/package/@vielzeug/illusionist) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
3
+ > Typed, deterministic, locale-aware fake data generator with seeded PRNG
6
4
 
7
5
  ## Installation
8
6
 
@@ -28,53 +26,6 @@ illusion.finance.iban(); // "IT0649896243786776403271206"
28
26
  illusion.location.city(); // "Denver"
29
27
  illusion.lorem.paragraph(); // "Dolor in fugiat anim dolor aute officia irure sunt..."
30
28
  illusion.system.semver(); // "7.4.0"
31
-
32
- illusion.dispose(); // [Symbol.dispose]() also works
33
- ```
34
-
35
- ## Entry Points
36
-
37
- - `@vielzeug/illusionist` — curated root exports + `createIllusion` factory
38
- - `@vielzeug/illusionist/person` — names, genders, job titles
39
- - `@vielzeug/illusionist/internet` — emails, URLs, IPs, user agents
40
- - `@vielzeug/illusionist/commerce` — product names, prices, departments
41
- - `@vielzeug/illusionist/date` — past/future dates, birthdays, weekdays
42
- - `@vielzeug/illusionist/finance` — IBANs, credit cards, crypto addresses
43
- - `@vielzeug/illusionist/location` — cities, streets, coordinates
44
- - `@vielzeug/illusionist/lorem` — lorem ipsum text generation
45
- - `@vielzeug/illusionist/system` — file paths, semver, UUIDs, cron
46
- - `@vielzeug/illusionist/seed` — `createSeed`, `mulberry32` PRNG
47
- - `@vielzeug/illusionist/locales` — locale objects (`en`, `de`); tree-shakeable, import only what you use
48
-
49
- ## Seeded Determinism
50
-
51
- Pass a `seed` for reproducible output — same seed always produces the same sequence across all categories. Omit `seed` for cryptographic randomness via `crypto.getRandomValues`.
52
-
53
- ```ts
54
- const a = createIllusion({ seed: 'test-fixture', locale: en });
55
- const b = createIllusion({ seed: 'test-fixture', locale: en });
56
-
57
- a.person.fullName() === b.person.fullName(); // true
58
- ```
59
-
60
- ## Locale Support
61
-
62
- Initial locales are explicit, tree-shakeable objects exported from `@vielzeug/illusionist/locales`. Locale data ships only for locales you import; the root package includes no default locale.
63
-
64
- ```ts
65
- import { de } from '@vielzeug/illusionist/locales';
66
-
67
- const illusion = createIllusion({ seed: 42, locale: de });
68
-
69
- illusion.person.firstName(); // "Mathilda"
70
- illusion.location.city(); // "Bielefeld"
71
- ```
72
-
73
- For dynamic app switching, load the locale before creating the synchronous instance:
74
-
75
- ```ts
76
- const { de } = await import('@vielzeug/illusionist/locales');
77
- const illusion = createIllusion({ locale: de });
78
29
  ```
79
30
 
80
31
  ## Documentation
@@ -83,6 +34,7 @@ const illusion = createIllusion({ locale: de });
83
34
  - [Usage Guide](https://vielzeug.dev/illusionist/usage)
84
35
  - [API Reference](https://vielzeug.dev/illusionist/api)
85
36
  - [Examples](https://vielzeug.dev/illusionist/examples)
37
+ - [Migration Guide](https://vielzeug.dev/illusionist/migration)
86
38
 
87
39
  ## License
88
40
 
@@ -1,2 +1,2 @@
1
- const e=require("./next-float.cjs");function t(t,n=.5){return e.nextFloat(t)<n}exports.boolean=t;
1
+ let e=require("@vielzeug/arsenal");function boolean(t,n=.5){return(0,e.randomFloat)(t)<n}exports.boolean=boolean;
2
2
  //# sourceMappingURL=boolean.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"boolean.cjs","names":[],"sources":["../../src/_helpers/boolean.ts"],"sourcesContent":["import type { RandomSource } from '@vielzeug/arsenal/random';\n\nimport { nextFloat } from './next-float';\n\n/** Generates a random boolean with an optional probability bias (0–1, default 0.5). */\nexport function boolean(source?: RandomSource, probability = 0.5): boolean {\n return nextFloat(source) < probability;\n}\n"],"mappings":"oCAKA,SAAgB,EAAQ,EAAuB,EAAc,GAAc,CACzE,OAAO,EAAA,UAAU,CAAM,EAAI,CAC7B"}
1
+ {"version":3,"file":"boolean.cjs","names":[],"sources":["../../src/_helpers/boolean.ts"],"sourcesContent":["import type { RandomSource } from '../types';\n\nimport { nextFloat } from './next-float';\n\n/** Generates a random boolean with an optional probability bias (0–1, default 0.5). */\nexport function boolean(source?: RandomSource, probability = 0.5): boolean {\n return nextFloat(source) < probability;\n}\n"],"mappings":"mCAKA,SAAgB,QAAQ,EAAuB,EAAc,GAAc,CACzE,OAAA,EAAO,EAAA,YAAA,CAAU,CAAM,EAAI,CAC7B"}
@@ -1,4 +1,4 @@
1
- import type { RandomSource } from '@vielzeug/arsenal/random';
1
+ import type { RandomSource } from '../types';
2
2
  /** Generates a random boolean with an optional probability bias (0–1, default 0.5). */
3
3
  export declare function boolean(source?: RandomSource, probability?: number): boolean;
4
4
  //# sourceMappingURL=boolean.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../src/_helpers/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAI7D,uFAAuF;AACvF,wBAAgB,OAAO,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,WAAW,SAAM,GAAG,OAAO,CAEzE"}
1
+ {"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../src/_helpers/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI7C,uFAAuF;AACvF,wBAAgB,OAAO,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,WAAW,SAAM,GAAG,OAAO,CAEzE"}
@@ -1,9 +1,2 @@
1
- import { nextFloat as e } from "./next-float.js";
2
- //#region src/_helpers/boolean.ts
3
- function t(t, n = .5) {
4
- return e(t) < n;
5
- }
6
- //#endregion
7
- export { t as boolean };
8
-
1
+ import{nextFloat as e}from"./next-float.js";function boolean(t,n=.5){return e(t)<n}export{boolean};
9
2
  //# sourceMappingURL=boolean.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"boolean.js","names":[],"sources":["../../src/_helpers/boolean.ts"],"sourcesContent":["import type { RandomSource } from '@vielzeug/arsenal/random';\n\nimport { nextFloat } from './next-float';\n\n/** Generates a random boolean with an optional probability bias (0–1, default 0.5). */\nexport function boolean(source?: RandomSource, probability = 0.5): boolean {\n return nextFloat(source) < probability;\n}\n"],"mappings":";;AAKA,SAAgB,EAAQ,GAAuB,IAAc,IAAc;CACzE,OAAO,EAAU,CAAM,IAAI;AAC7B"}
1
+ {"version":3,"file":"boolean.js","names":[],"sources":["../../src/_helpers/boolean.ts"],"sourcesContent":["import type { RandomSource } from '../types';\n\nimport { nextFloat } from './next-float';\n\n/** Generates a random boolean with an optional probability bias (0–1, default 0.5). */\nexport function boolean(source?: RandomSource, probability = 0.5): boolean {\n return nextFloat(source) < probability;\n}\n"],"mappings":"4CAKA,SAAgB,QAAQ,EAAuB,EAAc,GAAc,CACzE,OAAO,EAAU,CAAM,EAAI,CAC7B"}
@@ -1,2 +1,2 @@
1
- const e=require("./next-float.cjs");function t(t,n,r){return t>n?t:t+e.nextFloat(r)*(n-t)}function n(e,n,r=2,i){let a=10**r,o=t(e*a,n*a,i);return Math.round(o)/a}exports.float=t,exports.floatFixed=n;
1
+ let e=require("@vielzeug/arsenal");function float(t,n,r){return t>n?t:t+(0,e.randomFloat)(r)*(n-t)}function floatFixed(e,t,n=2,r){let i=10**n,a=float(e*i,t*i,r);return Math.round(a)/i}exports.float=float,exports.floatFixed=floatFixed;
2
2
  //# sourceMappingURL=float.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"float.cjs","names":[],"sources":["../../src/_helpers/float.ts"],"sourcesContent":["import type { RandomSource } from '@vielzeug/arsenal/random';\n\nimport { nextFloat } from './next-float';\n\n/**\n * Generates a random float in `[min, max)`.\n * Pass `min` = `max` for a constant; the result is still `min` (not `max`).\n */\nexport function float(min: number, max: number, source?: RandomSource): number {\n if (min > max) return min;\n\n return min + nextFloat(source) * (max - min);\n}\n\n/** Generates a random float with a fixed number of decimal places. */\nexport function floatFixed(min: number, max: number, decimals = 2, source?: RandomSource): number {\n const factor = 10 ** decimals;\n const scaled = float(min * factor, max * factor, source);\n\n return Math.round(scaled) / factor;\n}\n"],"mappings":"oCAQA,SAAgB,EAAM,EAAa,EAAa,EAA+B,CAG7E,OAFI,EAAM,EAAY,EAEf,EAAM,EAAA,UAAU,CAAM,GAAK,EAAM,EAC1C,CAGA,SAAgB,EAAW,EAAa,EAAa,EAAW,EAAG,EAA+B,CAChG,IAAM,EAAS,IAAM,EACf,EAAS,EAAM,EAAM,EAAQ,EAAM,EAAQ,CAAM,EAEvD,OAAO,KAAK,MAAM,CAAM,EAAI,CAC9B"}
1
+ {"version":3,"file":"float.cjs","names":[],"sources":["../../src/_helpers/float.ts"],"sourcesContent":["import type { RandomSource } from '../types';\n\nimport { nextFloat } from './next-float';\n\n/**\n * Generates a random float in `[min, max)`.\n * Pass `min` = `max` for a constant; the result is still `min` (not `max`).\n */\nexport function float(min: number, max: number, source?: RandomSource): number {\n if (min > max) return min;\n\n return min + nextFloat(source) * (max - min);\n}\n\n/** Generates a random float with a fixed number of decimal places. */\nexport function floatFixed(min: number, max: number, decimals = 2, source?: RandomSource): number {\n const factor = 10 ** decimals;\n const scaled = float(min * factor, max * factor, source);\n\n return Math.round(scaled) / factor;\n}\n"],"mappings":"mCAQA,SAAgB,MAAM,EAAa,EAAa,EAA+B,CAG7E,OAFI,EAAM,EAAY,EAEf,GAAA,EAAM,EAAA,YAAA,CAAU,CAAM,GAAK,EAAM,EAC1C,CAGA,SAAgB,WAAW,EAAa,EAAa,EAAW,EAAG,EAA+B,CAChG,IAAM,EAAS,IAAM,EACf,EAAS,MAAM,EAAM,EAAQ,EAAM,EAAQ,CAAM,EAEvD,OAAO,KAAK,MAAM,CAAM,EAAI,CAC9B"}
@@ -1,4 +1,4 @@
1
- import type { RandomSource } from '@vielzeug/arsenal/random';
1
+ import type { RandomSource } from '../types';
2
2
  /**
3
3
  * Generates a random float in `[min, max)`.
4
4
  * Pass `min` = `max` for a constant; the result is still `min` (not `max`).
@@ -1 +1 @@
1
- {"version":3,"file":"float.d.ts","sourceRoot":"","sources":["../../src/_helpers/float.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAI7D;;;GAGG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAI7E;AAED,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,SAAI,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAKhG"}
1
+ {"version":3,"file":"float.d.ts","sourceRoot":"","sources":["../../src/_helpers/float.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI7C;;;GAGG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAI7E;AAED,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,SAAI,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAKhG"}
@@ -1,13 +1,2 @@
1
- import { nextFloat as e } from "./next-float.js";
2
- //#region src/_helpers/float.ts
3
- function t(t, n, r) {
4
- return t > n ? t : t + e(r) * (n - t);
5
- }
6
- function n(e, n, r = 2, i) {
7
- let a = 10 ** r, o = t(e * a, n * a, i);
8
- return Math.round(o) / a;
9
- }
10
- //#endregion
11
- export { t as float, n as floatFixed };
12
-
1
+ import{nextFloat as e}from"./next-float.js";function float(t,n,r){return t>n?t:t+e(r)*(n-t)}function floatFixed(e,t,n=2,r){let i=10**n,a=float(e*i,t*i,r);return Math.round(a)/i}export{float,floatFixed};
13
2
  //# sourceMappingURL=float.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"float.js","names":[],"sources":["../../src/_helpers/float.ts"],"sourcesContent":["import type { RandomSource } from '@vielzeug/arsenal/random';\n\nimport { nextFloat } from './next-float';\n\n/**\n * Generates a random float in `[min, max)`.\n * Pass `min` = `max` for a constant; the result is still `min` (not `max`).\n */\nexport function float(min: number, max: number, source?: RandomSource): number {\n if (min > max) return min;\n\n return min + nextFloat(source) * (max - min);\n}\n\n/** Generates a random float with a fixed number of decimal places. */\nexport function floatFixed(min: number, max: number, decimals = 2, source?: RandomSource): number {\n const factor = 10 ** decimals;\n const scaled = float(min * factor, max * factor, source);\n\n return Math.round(scaled) / factor;\n}\n"],"mappings":";;AAQA,SAAgB,EAAM,GAAa,GAAa,GAA+B;CAG7E,OAFI,IAAM,IAAY,IAEf,IAAM,EAAU,CAAM,KAAK,IAAM;AAC1C;AAGA,SAAgB,EAAW,GAAa,GAAa,IAAW,GAAG,GAA+B;CAChG,IAAM,IAAS,MAAM,GACf,IAAS,EAAM,IAAM,GAAQ,IAAM,GAAQ,CAAM;CAEvD,OAAO,KAAK,MAAM,CAAM,IAAI;AAC9B"}
1
+ {"version":3,"file":"float.js","names":[],"sources":["../../src/_helpers/float.ts"],"sourcesContent":["import type { RandomSource } from '../types';\n\nimport { nextFloat } from './next-float';\n\n/**\n * Generates a random float in `[min, max)`.\n * Pass `min` = `max` for a constant; the result is still `min` (not `max`).\n */\nexport function float(min: number, max: number, source?: RandomSource): number {\n if (min > max) return min;\n\n return min + nextFloat(source) * (max - min);\n}\n\n/** Generates a random float with a fixed number of decimal places. */\nexport function floatFixed(min: number, max: number, decimals = 2, source?: RandomSource): number {\n const factor = 10 ** decimals;\n const scaled = float(min * factor, max * factor, source);\n\n return Math.round(scaled) / factor;\n}\n"],"mappings":"4CAQA,SAAgB,MAAM,EAAa,EAAa,EAA+B,CAG7E,OAFI,EAAM,EAAY,EAEf,EAAM,EAAU,CAAM,GAAK,EAAM,EAC1C,CAGA,SAAgB,WAAW,EAAa,EAAa,EAAW,EAAG,EAA+B,CAChG,IAAM,EAAS,IAAM,EACf,EAAS,MAAM,EAAM,EAAQ,EAAM,EAAQ,CAAM,EAEvD,OAAO,KAAK,MAAM,CAAM,EAAI,CAC9B"}
@@ -1,2 +1,2 @@
1
- let e=require("@vielzeug/arsenal/random");function t(t,n,r){return(0,e.random)(t,n,r)}exports.int=t;
1
+ let e=require("@vielzeug/arsenal");function int(t,n,r){return(0,e.random)(t,n,r)}exports.int=int;
2
2
  //# sourceMappingURL=int.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"int.cjs","names":[],"sources":["../../src/_helpers/int.ts"],"sourcesContent":["import type { RandomSource } from '@vielzeug/arsenal/random';\nimport { random } from '@vielzeug/arsenal/random';\n\n/** Generates a random integer in `[min, max]` (inclusive). */\nexport function int(min: number, max: number, source?: RandomSource): number {\n return random(min, max, source);\n}\n"],"mappings":"0CAIA,SAAgB,EAAI,EAAa,EAAa,EAA+B,CAC3E,OAAA,EAAO,EAAA,OAAA,CAAO,EAAK,EAAK,CAAM,CAChC"}
1
+ {"version":3,"file":"int.cjs","names":[],"sources":["../../src/_helpers/int.ts"],"sourcesContent":["import { random } from '@vielzeug/arsenal';\n\nimport type { RandomSource } from '../types';\n\n/** Generates a random integer in `[min, max]` (inclusive). */\nexport function int(min: number, max: number, source?: RandomSource): number {\n return random(min, max, source);\n}\n"],"mappings":"mCAKA,SAAgB,IAAI,EAAa,EAAa,EAA+B,CAC3E,OAAA,EAAO,EAAA,OAAA,CAAO,EAAK,EAAK,CAAM,CAChC"}
@@ -1,4 +1,4 @@
1
- import type { RandomSource } from '@vielzeug/arsenal/random';
1
+ import type { RandomSource } from '../types';
2
2
  /** Generates a random integer in `[min, max]` (inclusive). */
3
3
  export declare function int(min: number, max: number, source?: RandomSource): number;
4
4
  //# sourceMappingURL=int.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"int.d.ts","sourceRoot":"","sources":["../../src/_helpers/int.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG7D,8DAA8D;AAC9D,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAE3E"}
1
+ {"version":3,"file":"int.d.ts","sourceRoot":"","sources":["../../src/_helpers/int.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,8DAA8D;AAC9D,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAE3E"}
@@ -1,9 +1,2 @@
1
- import { random as e } from "@vielzeug/arsenal/random";
2
- //#region src/_helpers/int.ts
3
- function t(t, n, r) {
4
- return e(t, n, r);
5
- }
6
- //#endregion
7
- export { t as int };
8
-
1
+ import{random as e}from"@vielzeug/arsenal";function int(t,n,r){return e(t,n,r)}export{int};
9
2
  //# sourceMappingURL=int.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"int.js","names":[],"sources":["../../src/_helpers/int.ts"],"sourcesContent":["import type { RandomSource } from '@vielzeug/arsenal/random';\nimport { random } from '@vielzeug/arsenal/random';\n\n/** Generates a random integer in `[min, max]` (inclusive). */\nexport function int(min: number, max: number, source?: RandomSource): number {\n return random(min, max, source);\n}\n"],"mappings":";;AAIA,SAAgB,EAAI,GAAa,GAAa,GAA+B;CAC3E,OAAO,EAAO,GAAK,GAAK,CAAM;AAChC"}
1
+ {"version":3,"file":"int.js","names":[],"sources":["../../src/_helpers/int.ts"],"sourcesContent":["import { random } from '@vielzeug/arsenal';\n\nimport type { RandomSource } from '../types';\n\n/** Generates a random integer in `[min, max]` (inclusive). */\nexport function int(min: number, max: number, source?: RandomSource): number {\n return random(min, max, source);\n}\n"],"mappings":"2CAKA,SAAgB,IAAI,EAAa,EAAa,EAA+B,CAC3E,OAAO,EAAO,EAAK,EAAK,CAAM,CAChC"}
@@ -1,4 +1,2 @@
1
- import type { RandomSource } from '@vielzeug/arsenal/random';
2
- /** Returns a float in `[0, 1)` from the source, falling back to `crypto.getRandomValues` when unset. */
3
- export declare function nextFloat(source?: RandomSource): number;
1
+ export { randomFloat as nextFloat } from '@vielzeug/arsenal';
4
2
  //# sourceMappingURL=next-float.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"next-float.d.ts","sourceRoot":"","sources":["../../src/_helpers/next-float.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,wGAAwG;AACxG,wBAAgB,SAAS,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAEvD"}
1
+ {"version":3,"file":"next-float.d.ts","sourceRoot":"","sources":["../../src/_helpers/next-float.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,8 +1 @@
1
- //#region src/_helpers/next-float.ts
2
- function e(e) {
3
- return e?.next() ?? crypto.getRandomValues(/* @__PURE__ */ new Uint32Array(1))[0] / 4294967296;
4
- }
5
- //#endregion
6
- export { e as nextFloat };
7
-
8
- //# sourceMappingURL=next-float.js.map
1
+ import{randomFloat as e}from"@vielzeug/arsenal";export{e as nextFloat};
@@ -1,2 +1,2 @@
1
- const e=require("./next-float.cjs");function t(t,n){return t.length===0?void 0:t[Math.floor(e.nextFloat(n)*t.length)]}function n(t,n){let r=``;for(let i=0;i<t;i++)r+=Math.floor(e.nextFloat(n)*10);return r}function r(t,n){let r=``;for(let i=0;i<t;i++)r+=`0123456789abcdef`[Math.floor(e.nextFloat(n)*16)];return r}function i(t,n){let r=``;for(let i=0;i<t;i++)r+=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`[Math.floor(e.nextFloat(n)*62)];return r}function a(t,n){let r=``;for(let i=0;i<t;i++)r+=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`[Math.floor(e.nextFloat(n)*58)];return r}exports.alphanumeric=i,exports.base58String=a,exports.hexString=r,exports.numericString=n,exports.pick=t;
1
+ let e=require("@vielzeug/arsenal");function pick(t,n){return t.length===0?void 0:t[Math.floor((0,e.randomFloat)(n)*t.length)]}function numericString(t,n){let r=``;for(let i=0;i<t;i++)r+=Math.floor((0,e.randomFloat)(n)*10);return r}function hexString(t,n){let r=``;for(let i=0;i<t;i++)r+=`0123456789abcdef`[Math.floor((0,e.randomFloat)(n)*16)];return r}function alphanumeric(t,n){let r=``;for(let i=0;i<t;i++)r+=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`[Math.floor((0,e.randomFloat)(n)*62)];return r}function base58String(t,n){let r=``;for(let i=0;i<t;i++)r+=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`[Math.floor((0,e.randomFloat)(n)*58)];return r}exports.alphanumeric=alphanumeric,exports.base58String=base58String,exports.hexString=hexString,exports.numericString=numericString,exports.pick=pick;
2
2
  //# sourceMappingURL=string.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"string.cjs","names":[],"sources":["../../src/_helpers/string.ts"],"sourcesContent":["import type { RandomSource } from '@vielzeug/arsenal/random';\n\nimport { nextFloat } from './next-float';\n\n/** Picks a random element from a readonly array. Returns `undefined` for empty arrays. */\nexport function pick<T>(array: readonly T[], source?: RandomSource): T | undefined {\n return array.length === 0 ? undefined : array[Math.floor(nextFloat(source) * array.length)];\n}\n\n/** Generates a string of random digits with a fixed length. */\nexport function numericString(length: number, source?: RandomSource): string {\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += Math.floor(nextFloat(source) * 10);\n }\n\n return result;\n}\n\n/** Generates a random hex string of the given length. */\nexport function hexString(length: number, source?: RandomSource): string {\n const chars = '0123456789abcdef';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.floor(nextFloat(source) * 16)];\n }\n\n return result;\n}\n\n/** Generates a random alphanumeric string of the given length. */\nexport function alphanumeric(length: number, source?: RandomSource): string {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.floor(nextFloat(source) * chars.length)];\n }\n\n return result;\n}\n\n/** Generates a random Base58 string (no 0, O, I, l) — used for Bitcoin-style addresses. */\nexport function base58String(length: number, source?: RandomSource): string {\n const chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.floor(nextFloat(source) * chars.length)];\n }\n\n return result;\n}\n"],"mappings":"oCAKA,SAAgB,EAAQ,EAAqB,EAAsC,CACjF,OAAO,EAAM,SAAW,EAAI,IAAA,GAAY,EAAM,KAAK,MAAM,EAAA,UAAU,CAAM,EAAI,EAAM,MAAM,EAC3F,CAGA,SAAgB,EAAc,EAAgB,EAA+B,CAC3E,IAAI,EAAS,GAEb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,IAC1B,GAAU,KAAK,MAAM,EAAA,UAAU,CAAM,EAAI,EAAE,EAG7C,OAAO,CACT,CAGA,SAAgB,EAAU,EAAgB,EAA+B,CACvE,IACI,EAAS,GAEb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,IAC1B,GAAU,mBAAM,KAAK,MAAM,EAAA,UAAU,CAAM,EAAI,EAAE,GAGnD,OAAO,CACT,CAGA,SAAgB,EAAa,EAAgB,EAA+B,CAC1E,IACI,EAAS,GAEb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,IAC1B,GAAU,iEAAM,KAAK,MAAM,EAAA,UAAU,CAAM,EAAI,EAAY,GAG7D,OAAO,CACT,CAGA,SAAgB,EAAa,EAAgB,EAA+B,CAC1E,IACI,EAAS,GAEb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,IAC1B,GAAU,6DAAM,KAAK,MAAM,EAAA,UAAU,CAAM,EAAI,EAAY,GAG7D,OAAO,CACT"}
1
+ {"version":3,"file":"string.cjs","names":[],"sources":["../../src/_helpers/string.ts"],"sourcesContent":["import type { RandomSource } from '../types';\n\nimport { nextFloat } from './next-float';\n\n/** Picks a random element from a readonly array. Returns `undefined` for empty arrays. */\nexport function pick<T>(array: readonly T[], source?: RandomSource): T | undefined {\n return array.length === 0 ? undefined : array[Math.floor(nextFloat(source) * array.length)];\n}\n\n/** Generates a string of random digits with a fixed length. */\nexport function numericString(length: number, source?: RandomSource): string {\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += Math.floor(nextFloat(source) * 10);\n }\n\n return result;\n}\n\n/** Generates a random hex string of the given length. */\nexport function hexString(length: number, source?: RandomSource): string {\n const chars = '0123456789abcdef';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.floor(nextFloat(source) * 16)];\n }\n\n return result;\n}\n\n/** Generates a random alphanumeric string of the given length. */\nexport function alphanumeric(length: number, source?: RandomSource): string {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.floor(nextFloat(source) * chars.length)];\n }\n\n return result;\n}\n\n/** Generates a random Base58 string (no 0, O, I, l) — used for Bitcoin-style addresses. */\nexport function base58String(length: number, source?: RandomSource): string {\n const chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.floor(nextFloat(source) * chars.length)];\n }\n\n return result;\n}\n"],"mappings":"mCAKA,SAAgB,KAAQ,EAAqB,EAAsC,CACjF,OAAO,EAAM,SAAW,EAAI,IAAA,GAAY,EAAM,KAAK,OAAA,EAAM,EAAA,YAAA,CAAU,CAAM,EAAI,EAAM,MAAM,EAC3F,CAGA,SAAgB,cAAc,EAAgB,EAA+B,CAC3E,IAAI,EAAS,GAEb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,IAC1B,GAAU,KAAK,OAAA,EAAM,EAAA,YAAA,CAAU,CAAM,EAAI,EAAE,EAG7C,OAAO,CACT,CAGA,SAAgB,UAAU,EAAgB,EAA+B,CACvE,IACI,EAAS,GAEb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,IAC1B,GAAU,mBAAM,KAAK,OAAA,EAAM,EAAA,YAAA,CAAU,CAAM,EAAI,EAAE,GAGnD,OAAO,CACT,CAGA,SAAgB,aAAa,EAAgB,EAA+B,CAC1E,IACI,EAAS,GAEb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,IAC1B,GAAU,iEAAM,KAAK,OAAA,EAAM,EAAA,YAAA,CAAU,CAAM,EAAI,EAAY,GAG7D,OAAO,CACT,CAGA,SAAgB,aAAa,EAAgB,EAA+B,CAC1E,IACI,EAAS,GAEb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,IAC1B,GAAU,6DAAM,KAAK,OAAA,EAAM,EAAA,YAAA,CAAU,CAAM,EAAI,EAAY,GAG7D,OAAO,CACT"}
@@ -1,4 +1,4 @@
1
- import type { RandomSource } from '@vielzeug/arsenal/random';
1
+ import type { RandomSource } from '../types';
2
2
  /** Picks a random element from a readonly array. Returns `undefined` for empty arrays. */
3
3
  export declare function pick<T>(array: readonly T[], source?: RandomSource): T | undefined;
4
4
  /** Generates a string of random digits with a fixed length. */
@@ -1 +1 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/_helpers/string.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAI7D,0FAA0F;AAC1F,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,CAAC,GAAG,SAAS,CAEjF;AAED,+DAA+D;AAC/D,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAQ3E;AAED,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CASvE;AAED,kEAAkE;AAClE,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAS1E;AAED,2FAA2F;AAC3F,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAS1E"}
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/_helpers/string.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI7C,0FAA0F;AAC1F,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,CAAC,GAAG,SAAS,CAEjF;AAED,+DAA+D;AAC/D,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAQ3E;AAED,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CASvE;AAED,kEAAkE;AAClE,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAS1E;AAED,2FAA2F;AAC3F,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAS1E"}
@@ -1,29 +1,2 @@
1
- import { nextFloat as e } from "./next-float.js";
2
- //#region src/_helpers/string.ts
3
- function t(t, n) {
4
- return t.length === 0 ? void 0 : t[Math.floor(e(n) * t.length)];
5
- }
6
- function n(t, n) {
7
- let r = "";
8
- for (let i = 0; i < t; i++) r += Math.floor(e(n) * 10);
9
- return r;
10
- }
11
- function r(t, n) {
12
- let r = "";
13
- for (let i = 0; i < t; i++) r += "0123456789abcdef"[Math.floor(e(n) * 16)];
14
- return r;
15
- }
16
- function i(t, n) {
17
- let r = "";
18
- for (let i = 0; i < t; i++) r += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(e(n) * 62)];
19
- return r;
20
- }
21
- function a(t, n) {
22
- let r = "";
23
- for (let i = 0; i < t; i++) r += "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"[Math.floor(e(n) * 58)];
24
- return r;
25
- }
26
- //#endregion
27
- export { i as alphanumeric, a as base58String, r as hexString, n as numericString, t as pick };
28
-
1
+ import{nextFloat as e}from"./next-float.js";function pick(t,n){return t.length===0?void 0:t[Math.floor(e(n)*t.length)]}function numericString(t,n){let r=``;for(let i=0;i<t;i++)r+=Math.floor(e(n)*10);return r}function hexString(t,n){let r=``;for(let i=0;i<t;i++)r+=`0123456789abcdef`[Math.floor(e(n)*16)];return r}function alphanumeric(t,n){let r=``;for(let i=0;i<t;i++)r+=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`[Math.floor(e(n)*62)];return r}function base58String(t,n){let r=``;for(let i=0;i<t;i++)r+=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`[Math.floor(e(n)*58)];return r}export{alphanumeric,base58String,hexString,numericString,pick};
29
2
  //# sourceMappingURL=string.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"string.js","names":[],"sources":["../../src/_helpers/string.ts"],"sourcesContent":["import type { RandomSource } from '@vielzeug/arsenal/random';\n\nimport { nextFloat } from './next-float';\n\n/** Picks a random element from a readonly array. Returns `undefined` for empty arrays. */\nexport function pick<T>(array: readonly T[], source?: RandomSource): T | undefined {\n return array.length === 0 ? undefined : array[Math.floor(nextFloat(source) * array.length)];\n}\n\n/** Generates a string of random digits with a fixed length. */\nexport function numericString(length: number, source?: RandomSource): string {\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += Math.floor(nextFloat(source) * 10);\n }\n\n return result;\n}\n\n/** Generates a random hex string of the given length. */\nexport function hexString(length: number, source?: RandomSource): string {\n const chars = '0123456789abcdef';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.floor(nextFloat(source) * 16)];\n }\n\n return result;\n}\n\n/** Generates a random alphanumeric string of the given length. */\nexport function alphanumeric(length: number, source?: RandomSource): string {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.floor(nextFloat(source) * chars.length)];\n }\n\n return result;\n}\n\n/** Generates a random Base58 string (no 0, O, I, l) — used for Bitcoin-style addresses. */\nexport function base58String(length: number, source?: RandomSource): string {\n const chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.floor(nextFloat(source) * chars.length)];\n }\n\n return result;\n}\n"],"mappings":";;AAKA,SAAgB,EAAQ,GAAqB,GAAsC;CACjF,OAAO,EAAM,WAAW,IAAI,KAAA,IAAY,EAAM,KAAK,MAAM,EAAU,CAAM,IAAI,EAAM,MAAM;AAC3F;AAGA,SAAgB,EAAc,GAAgB,GAA+B;CAC3E,IAAI,IAAS;CAEb,KAAK,IAAI,IAAI,GAAG,IAAI,GAAQ,KAC1B,KAAU,KAAK,MAAM,EAAU,CAAM,IAAI,EAAE;CAG7C,OAAO;AACT;AAGA,SAAgB,EAAU,GAAgB,GAA+B;CACvE,IACI,IAAS;CAEb,KAAK,IAAI,IAAI,GAAG,IAAI,GAAQ,KAC1B,KAAU,mBAAM,KAAK,MAAM,EAAU,CAAM,IAAI,EAAE;CAGnD,OAAO;AACT;AAGA,SAAgB,EAAa,GAAgB,GAA+B;CAC1E,IACI,IAAS;CAEb,KAAK,IAAI,IAAI,GAAG,IAAI,GAAQ,KAC1B,KAAU,iEAAM,KAAK,MAAM,EAAU,CAAM,IAAI,EAAY;CAG7D,OAAO;AACT;AAGA,SAAgB,EAAa,GAAgB,GAA+B;CAC1E,IACI,IAAS;CAEb,KAAK,IAAI,IAAI,GAAG,IAAI,GAAQ,KAC1B,KAAU,6DAAM,KAAK,MAAM,EAAU,CAAM,IAAI,EAAY;CAG7D,OAAO;AACT"}
1
+ {"version":3,"file":"string.js","names":[],"sources":["../../src/_helpers/string.ts"],"sourcesContent":["import type { RandomSource } from '../types';\n\nimport { nextFloat } from './next-float';\n\n/** Picks a random element from a readonly array. Returns `undefined` for empty arrays. */\nexport function pick<T>(array: readonly T[], source?: RandomSource): T | undefined {\n return array.length === 0 ? undefined : array[Math.floor(nextFloat(source) * array.length)];\n}\n\n/** Generates a string of random digits with a fixed length. */\nexport function numericString(length: number, source?: RandomSource): string {\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += Math.floor(nextFloat(source) * 10);\n }\n\n return result;\n}\n\n/** Generates a random hex string of the given length. */\nexport function hexString(length: number, source?: RandomSource): string {\n const chars = '0123456789abcdef';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.floor(nextFloat(source) * 16)];\n }\n\n return result;\n}\n\n/** Generates a random alphanumeric string of the given length. */\nexport function alphanumeric(length: number, source?: RandomSource): string {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.floor(nextFloat(source) * chars.length)];\n }\n\n return result;\n}\n\n/** Generates a random Base58 string (no 0, O, I, l) — used for Bitcoin-style addresses. */\nexport function base58String(length: number, source?: RandomSource): string {\n const chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.floor(nextFloat(source) * chars.length)];\n }\n\n return result;\n}\n"],"mappings":"4CAKA,SAAgB,KAAQ,EAAqB,EAAsC,CACjF,OAAO,EAAM,SAAW,EAAI,IAAA,GAAY,EAAM,KAAK,MAAM,EAAU,CAAM,EAAI,EAAM,MAAM,EAC3F,CAGA,SAAgB,cAAc,EAAgB,EAA+B,CAC3E,IAAI,EAAS,GAEb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,IAC1B,GAAU,KAAK,MAAM,EAAU,CAAM,EAAI,EAAE,EAG7C,OAAO,CACT,CAGA,SAAgB,UAAU,EAAgB,EAA+B,CACvE,IACI,EAAS,GAEb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,IAC1B,GAAU,mBAAM,KAAK,MAAM,EAAU,CAAM,EAAI,EAAE,GAGnD,OAAO,CACT,CAGA,SAAgB,aAAa,EAAgB,EAA+B,CAC1E,IACI,EAAS,GAEb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,IAC1B,GAAU,iEAAM,KAAK,MAAM,EAAU,CAAM,EAAI,EAAY,GAG7D,OAAO,CACT,CAGA,SAAgB,aAAa,EAAgB,EAA+B,CAC1E,IACI,EAAS,GAEb,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,IAC1B,GAAU,6DAAM,KAAK,MAAM,EAAU,CAAM,EAAI,EAAY,GAG7D,OAAO,CACT"}
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};exports.__exportAll=t;
1
+ var e=Object.defineProperty,__exportAll=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};exports.__exportAll=__exportAll;
@@ -1,11 +1 @@
1
- //#region \0rolldown/runtime.js
2
- var e = Object.defineProperty, t = (t, n) => {
3
- let r = {};
4
- for (var i in t) e(r, i, {
5
- get: t[i],
6
- enumerable: !0
7
- });
8
- return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
9
- };
10
- //#endregion
11
- export { t as __exportAll };
1
+ var e=Object.defineProperty,__exportAll=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};export{__exportAll};
@@ -1,2 +1,2 @@
1
- const e=require("../_virtual/_rolldown/runtime.cjs"),t=require("../_helpers/float.cjs"),n=require("../_helpers/int.cjs"),r=require("../_helpers/string.cjs"),i=require("./data.cjs");let a=require("@vielzeug/coins");var o=e.__exportAll({department:()=>f,price:()=>p,productAdjective:()=>c,productDescription:()=>m,productMaterial:()=>l,productName:()=>d,productNoun:()=>u}),s={EUR:a.EUR,GBP:a.GBP,USD:a.USD};function c(e){return r.pick(i.COMMERCE_DATA.productAdjectives,e.source)}function l(e){return r.pick(i.COMMERCE_DATA.productMaterials,e.source)}function u(e){return r.pick(i.COMMERCE_DATA.productNouns,e.source)}function d(e){return`${c(e)} ${l(e)} ${u(e)}`}function f(e){return r.pick(i.COMMERCE_DATA.departments,e.source)}function p(e,n={}){let r=n.min??.01,i=n.max??1e3,o=n.currency??`USD`,c=t.floatFixed(r,i,2,e.source);return(0,a.money)(c.toFixed(2),s[o])}function m(e){let t=n.int(1,2,e.source),a=[];for(let n=0;n<t;n++){let t=r.pick(i.COMMERCE_DATA.productAdjectives,e.source),n=r.pick(i.COMMERCE_DATA.productMaterials,e.source),o=r.pick(i.COMMERCE_DATA.productNouns,e.source),s=r.pick(i.COMMERCE_DATA.departments,e.source);a.push(`The ${t.toLowerCase()} ${n.toLowerCase()} ${o.toLowerCase()} is a great choice for your ${s.toLowerCase()} needs.`)}return a.join(` `)}Object.defineProperty(exports,"commerce_exports",{enumerable:!0,get:function(){return o}}),exports.department=f,exports.price=p,exports.productAdjective=c,exports.productDescription=m,exports.productMaterial=l,exports.productName=d,exports.productNoun=u;
1
+ const e=require("../_virtual/_rolldown/runtime.cjs"),t=require("../_helpers/float.cjs"),n=require("../_helpers/int.cjs"),r=require("../_helpers/string.cjs"),i=require("./data.cjs");let a=require("@vielzeug/coins");var o=e.__exportAll({department:()=>department,price:()=>price,productAdjective:()=>productAdjective,productDescription:()=>productDescription,productMaterial:()=>productMaterial,productName:()=>productName,productNoun:()=>productNoun}),s={EUR:a.EUR,GBP:a.GBP,USD:a.USD};function productAdjective(e){return r.pick(i.COMMERCE_DATA.productAdjectives,e.source)}function productMaterial(e){return r.pick(i.COMMERCE_DATA.productMaterials,e.source)}function productNoun(e){return r.pick(i.COMMERCE_DATA.productNouns,e.source)}function productName(e){return`${productAdjective(e)} ${productMaterial(e)} ${productNoun(e)}`}function department(e){return r.pick(i.COMMERCE_DATA.departments,e.source)}function price(e,n={}){let r=n.min??.01,i=n.max??1e3,o=n.currency??`USD`,c=t.floatFixed(r,i,2,e.source);return(0,a.money)(c.toFixed(2),s[o])}function productDescription(e){let t=n.int(1,2,e.source),a=[];for(let n=0;n<t;n++){let t=r.pick(i.COMMERCE_DATA.productAdjectives,e.source),n=r.pick(i.COMMERCE_DATA.productMaterials,e.source),o=r.pick(i.COMMERCE_DATA.productNouns,e.source),s=r.pick(i.COMMERCE_DATA.departments,e.source);a.push(`The ${t.toLowerCase()} ${n.toLowerCase()} ${o.toLowerCase()} is a great choice for your ${s.toLowerCase()} needs.`)}return a.join(` `)}Object.defineProperty(exports,"commerce_exports",{enumerable:!0,get:function(){return o}}),exports.department=department,exports.price=price,exports.productAdjective=productAdjective,exports.productDescription=productDescription,exports.productMaterial=productMaterial,exports.productName=productName,exports.productNoun=productNoun;
2
2
  //# sourceMappingURL=commerce.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"commerce.cjs","names":[],"sources":["../../src/commerce/commerce.ts"],"sourcesContent":["import { type Currency, EUR, GBP, type Money, money, USD } from '@vielzeug/coins';\n\nimport { floatFixed } from '../_helpers/float';\nimport { int } from '../_helpers/int';\nimport { pick } from '../_helpers/string';\nimport type { IllusionistContext } from '../types';\nimport { COMMERCE_DATA } from './data';\n\nconst CURRENCIES: Record<'USD' | 'EUR' | 'GBP', Currency> = { EUR, GBP, USD };\n\nexport type PriceOptions = {\n readonly min?: number;\n readonly max?: number;\n readonly currency?: 'USD' | 'EUR' | 'GBP';\n};\n\nexport function productAdjective(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.productAdjectives, ctx.source)!;\n}\n\nexport function productMaterial(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.productMaterials, ctx.source)!;\n}\n\nexport function productNoun(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.productNouns, ctx.source)!;\n}\n\nexport function productName(ctx: IllusionistContext): string {\n return `${productAdjective(ctx)} ${productMaterial(ctx)} ${productNoun(ctx)}`;\n}\n\nexport function department(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.departments, ctx.source)!;\n}\n\nexport function price(ctx: IllusionistContext, opts: PriceOptions = {}): Money {\n const min = opts.min ?? 0.01;\n const max = opts.max ?? 1000;\n const code = opts.currency ?? 'USD';\n const amount = floatFixed(min, max, 2, ctx.source);\n\n return money(amount.toFixed(2), CURRENCIES[code]);\n}\n\nexport function productDescription(ctx: IllusionistContext): string {\n const sentences = int(1, 2, ctx.source);\n const parts: string[] = [];\n\n for (let i = 0; i < sentences; i++) {\n const adjective = pick(COMMERCE_DATA.productAdjectives, ctx.source)!;\n const material = pick(COMMERCE_DATA.productMaterials, ctx.source)!;\n const noun = pick(COMMERCE_DATA.productNouns, ctx.source)!;\n const department = pick(COMMERCE_DATA.departments, ctx.source)!;\n\n parts.push(\n `The ${adjective.toLowerCase()} ${material.toLowerCase()} ${noun.toLowerCase()} is a great choice for your ${department.toLowerCase()} needs.`,\n );\n }\n\n return parts.join(' ');\n}\n"],"mappings":"oXAQM,EAAsD,CAAE,IAAA,EAAA,IAAK,IAAA,EAAA,IAAK,IAAA,EAAA,GAAI,EAQ5E,SAAgB,EAAiB,EAAiC,CAChE,OAAO,EAAA,KAAK,EAAA,cAAc,kBAAmB,EAAI,MAAM,CACzD,CAEA,SAAgB,EAAgB,EAAiC,CAC/D,OAAO,EAAA,KAAK,EAAA,cAAc,iBAAkB,EAAI,MAAM,CACxD,CAEA,SAAgB,EAAY,EAAiC,CAC3D,OAAO,EAAA,KAAK,EAAA,cAAc,aAAc,EAAI,MAAM,CACpD,CAEA,SAAgB,EAAY,EAAiC,CAC3D,MAAO,GAAG,EAAiB,CAAG,EAAE,GAAG,EAAgB,CAAG,EAAE,GAAG,EAAY,CAAG,GAC5E,CAEA,SAAgB,EAAW,EAAiC,CAC1D,OAAO,EAAA,KAAK,EAAA,cAAc,YAAa,EAAI,MAAM,CACnD,CAEA,SAAgB,EAAM,EAAyB,EAAqB,CAAC,EAAU,CAC7E,IAAM,EAAM,EAAK,KAAO,IAClB,EAAM,EAAK,KAAO,IAClB,EAAO,EAAK,UAAY,MACxB,EAAS,EAAA,WAAW,EAAK,EAAK,EAAG,EAAI,MAAM,EAEjD,OAAA,EAAO,EAAA,MAAA,CAAM,EAAO,QAAQ,CAAC,EAAG,EAAW,EAAK,CAClD,CAEA,SAAgB,EAAmB,EAAiC,CAClE,IAAM,EAAY,EAAA,IAAI,EAAG,EAAG,EAAI,MAAM,EAChC,EAAkB,CAAC,EAEzB,IAAK,IAAI,EAAI,EAAG,EAAI,EAAW,IAAK,CAClC,IAAM,EAAY,EAAA,KAAK,EAAA,cAAc,kBAAmB,EAAI,MAAM,EAC5D,EAAW,EAAA,KAAK,EAAA,cAAc,iBAAkB,EAAI,MAAM,EAC1D,EAAO,EAAA,KAAK,EAAA,cAAc,aAAc,EAAI,MAAM,EAClD,EAAa,EAAA,KAAK,EAAA,cAAc,YAAa,EAAI,MAAM,EAE7D,EAAM,KACJ,OAAO,EAAU,YAAY,EAAE,GAAG,EAAS,YAAY,EAAE,GAAG,EAAK,YAAY,EAAE,8BAA8B,EAAW,YAAY,EAAE,QACxI,CACF,CAEA,OAAO,EAAM,KAAK,GAAG,CACvB"}
1
+ {"version":3,"file":"commerce.cjs","names":[],"sources":["../../src/commerce/commerce.ts"],"sourcesContent":["import { type Currency, EUR, GBP, type Money, money, USD } from '@vielzeug/coins';\n\nimport { floatFixed } from '../_helpers/float';\nimport { int } from '../_helpers/int';\nimport { pick } from '../_helpers/string';\nimport type { IllusionistContext } from '../types';\nimport { COMMERCE_DATA } from './data';\n\nconst CURRENCIES: Record<'USD' | 'EUR' | 'GBP', Currency> = { EUR, GBP, USD };\n\nexport type PriceOptions = {\n readonly min?: number;\n readonly max?: number;\n readonly currency?: 'USD' | 'EUR' | 'GBP';\n};\n\nexport function productAdjective(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.productAdjectives, ctx.source)!;\n}\n\nexport function productMaterial(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.productMaterials, ctx.source)!;\n}\n\nexport function productNoun(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.productNouns, ctx.source)!;\n}\n\nexport function productName(ctx: IllusionistContext): string {\n return `${productAdjective(ctx)} ${productMaterial(ctx)} ${productNoun(ctx)}`;\n}\n\nexport function department(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.departments, ctx.source)!;\n}\n\nexport function price(ctx: IllusionistContext, opts: PriceOptions = {}): Money {\n const min = opts.min ?? 0.01;\n const max = opts.max ?? 1000;\n const code = opts.currency ?? 'USD';\n const amount = floatFixed(min, max, 2, ctx.source);\n\n return money(amount.toFixed(2), CURRENCIES[code]);\n}\n\nexport function productDescription(ctx: IllusionistContext): string {\n const sentences = int(1, 2, ctx.source);\n const parts: string[] = [];\n\n for (let i = 0; i < sentences; i++) {\n const adjective = pick(COMMERCE_DATA.productAdjectives, ctx.source)!;\n const material = pick(COMMERCE_DATA.productMaterials, ctx.source)!;\n const noun = pick(COMMERCE_DATA.productNouns, ctx.source)!;\n const department = pick(COMMERCE_DATA.departments, ctx.source)!;\n\n parts.push(\n `The ${adjective.toLowerCase()} ${material.toLowerCase()} ${noun.toLowerCase()} is a great choice for your ${department.toLowerCase()} needs.`,\n );\n }\n\n return parts.join(' ');\n}\n"],"mappings":"mcAQM,EAAsD,CAAE,IAAA,EAAA,IAAK,IAAA,EAAA,IAAK,IAAA,EAAA,GAAI,EAQ5E,SAAgB,iBAAiB,EAAiC,CAChE,OAAO,EAAA,KAAK,EAAA,cAAc,kBAAmB,EAAI,MAAM,CACzD,CAEA,SAAgB,gBAAgB,EAAiC,CAC/D,OAAO,EAAA,KAAK,EAAA,cAAc,iBAAkB,EAAI,MAAM,CACxD,CAEA,SAAgB,YAAY,EAAiC,CAC3D,OAAO,EAAA,KAAK,EAAA,cAAc,aAAc,EAAI,MAAM,CACpD,CAEA,SAAgB,YAAY,EAAiC,CAC3D,MAAO,GAAG,iBAAiB,CAAG,EAAE,GAAG,gBAAgB,CAAG,EAAE,GAAG,YAAY,CAAG,GAC5E,CAEA,SAAgB,WAAW,EAAiC,CAC1D,OAAO,EAAA,KAAK,EAAA,cAAc,YAAa,EAAI,MAAM,CACnD,CAEA,SAAgB,MAAM,EAAyB,EAAqB,CAAC,EAAU,CAC7E,IAAM,EAAM,EAAK,KAAO,IAClB,EAAM,EAAK,KAAO,IAClB,EAAO,EAAK,UAAY,MACxB,EAAS,EAAA,WAAW,EAAK,EAAK,EAAG,EAAI,MAAM,EAEjD,OAAA,EAAO,EAAA,MAAA,CAAM,EAAO,QAAQ,CAAC,EAAG,EAAW,EAAK,CAClD,CAEA,SAAgB,mBAAmB,EAAiC,CAClE,IAAM,EAAY,EAAA,IAAI,EAAG,EAAG,EAAI,MAAM,EAChC,EAAkB,CAAC,EAEzB,IAAK,IAAI,EAAI,EAAG,EAAI,EAAW,IAAK,CAClC,IAAM,EAAY,EAAA,KAAK,EAAA,cAAc,kBAAmB,EAAI,MAAM,EAC5D,EAAW,EAAA,KAAK,EAAA,cAAc,iBAAkB,EAAI,MAAM,EAC1D,EAAO,EAAA,KAAK,EAAA,cAAc,aAAc,EAAI,MAAM,EAClD,EAAa,EAAA,KAAK,EAAA,cAAc,YAAa,EAAI,MAAM,EAE7D,EAAM,KACJ,OAAO,EAAU,YAAY,EAAE,GAAG,EAAS,YAAY,EAAE,GAAG,EAAK,YAAY,EAAE,8BAA8B,EAAW,YAAY,EAAE,QACxI,CACF,CAEA,OAAO,EAAM,KAAK,GAAG,CACvB"}
@@ -1,51 +1,2 @@
1
- import { __exportAll as e } from "../_virtual/_rolldown/runtime.js";
2
- import { floatFixed as t } from "../_helpers/float.js";
3
- import { int as n } from "../_helpers/int.js";
4
- import { pick as r } from "../_helpers/string.js";
5
- import { COMMERCE_DATA as i } from "./data.js";
6
- import { EUR as a, GBP as o, USD as s, money as c } from "@vielzeug/coins";
7
- //#region src/commerce/commerce.ts
8
- var l = /* @__PURE__ */ e({
9
- department: () => h,
10
- price: () => g,
11
- productAdjective: () => d,
12
- productDescription: () => _,
13
- productMaterial: () => f,
14
- productName: () => m,
15
- productNoun: () => p
16
- }), u = {
17
- EUR: a,
18
- GBP: o,
19
- USD: s
20
- };
21
- function d(e) {
22
- return r(i.productAdjectives, e.source);
23
- }
24
- function f(e) {
25
- return r(i.productMaterials, e.source);
26
- }
27
- function p(e) {
28
- return r(i.productNouns, e.source);
29
- }
30
- function m(e) {
31
- return `${d(e)} ${f(e)} ${p(e)}`;
32
- }
33
- function h(e) {
34
- return r(i.departments, e.source);
35
- }
36
- function g(e, n = {}) {
37
- let r = n.min ?? .01, i = n.max ?? 1e3, a = n.currency ?? "USD", o = t(r, i, 2, e.source);
38
- return c(o.toFixed(2), u[a]);
39
- }
40
- function _(e) {
41
- let t = n(1, 2, e.source), a = [];
42
- for (let n = 0; n < t; n++) {
43
- let t = r(i.productAdjectives, e.source), n = r(i.productMaterials, e.source), o = r(i.productNouns, e.source), s = r(i.departments, e.source);
44
- a.push(`The ${t.toLowerCase()} ${n.toLowerCase()} ${o.toLowerCase()} is a great choice for your ${s.toLowerCase()} needs.`);
45
- }
46
- return a.join(" ");
47
- }
48
- //#endregion
49
- export { l as commerce_exports, h as department, g as price, d as productAdjective, _ as productDescription, f as productMaterial, m as productName, p as productNoun };
50
-
1
+ import{__exportAll as e}from"../_virtual/_rolldown/runtime.js";import{floatFixed as t}from"../_helpers/float.js";import{int as n}from"../_helpers/int.js";import{pick as r}from"../_helpers/string.js";import{COMMERCE_DATA as i}from"./data.js";import{EUR as a,GBP as o,USD as s,money as c}from"@vielzeug/coins";var l=e({department:()=>department,price:()=>price,productAdjective:()=>productAdjective,productDescription:()=>productDescription,productMaterial:()=>productMaterial,productName:()=>productName,productNoun:()=>productNoun}),u={EUR:a,GBP:o,USD:s};function productAdjective(e){return r(i.productAdjectives,e.source)}function productMaterial(e){return r(i.productMaterials,e.source)}function productNoun(e){return r(i.productNouns,e.source)}function productName(e){return`${productAdjective(e)} ${productMaterial(e)} ${productNoun(e)}`}function department(e){return r(i.departments,e.source)}function price(e,n={}){let r=n.min??.01,i=n.max??1e3,a=n.currency??`USD`,o=t(r,i,2,e.source);return c(o.toFixed(2),u[a])}function productDescription(e){let t=n(1,2,e.source),a=[];for(let n=0;n<t;n++){let t=r(i.productAdjectives,e.source),n=r(i.productMaterials,e.source),o=r(i.productNouns,e.source),s=r(i.departments,e.source);a.push(`The ${t.toLowerCase()} ${n.toLowerCase()} ${o.toLowerCase()} is a great choice for your ${s.toLowerCase()} needs.`)}return a.join(` `)}export{l as commerce_exports,department,price,productAdjective,productDescription,productMaterial,productName,productNoun};
51
2
  //# sourceMappingURL=commerce.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commerce.js","names":[],"sources":["../../src/commerce/commerce.ts"],"sourcesContent":["import { type Currency, EUR, GBP, type Money, money, USD } from '@vielzeug/coins';\n\nimport { floatFixed } from '../_helpers/float';\nimport { int } from '../_helpers/int';\nimport { pick } from '../_helpers/string';\nimport type { IllusionistContext } from '../types';\nimport { COMMERCE_DATA } from './data';\n\nconst CURRENCIES: Record<'USD' | 'EUR' | 'GBP', Currency> = { EUR, GBP, USD };\n\nexport type PriceOptions = {\n readonly min?: number;\n readonly max?: number;\n readonly currency?: 'USD' | 'EUR' | 'GBP';\n};\n\nexport function productAdjective(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.productAdjectives, ctx.source)!;\n}\n\nexport function productMaterial(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.productMaterials, ctx.source)!;\n}\n\nexport function productNoun(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.productNouns, ctx.source)!;\n}\n\nexport function productName(ctx: IllusionistContext): string {\n return `${productAdjective(ctx)} ${productMaterial(ctx)} ${productNoun(ctx)}`;\n}\n\nexport function department(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.departments, ctx.source)!;\n}\n\nexport function price(ctx: IllusionistContext, opts: PriceOptions = {}): Money {\n const min = opts.min ?? 0.01;\n const max = opts.max ?? 1000;\n const code = opts.currency ?? 'USD';\n const amount = floatFixed(min, max, 2, ctx.source);\n\n return money(amount.toFixed(2), CURRENCIES[code]);\n}\n\nexport function productDescription(ctx: IllusionistContext): string {\n const sentences = int(1, 2, ctx.source);\n const parts: string[] = [];\n\n for (let i = 0; i < sentences; i++) {\n const adjective = pick(COMMERCE_DATA.productAdjectives, ctx.source)!;\n const material = pick(COMMERCE_DATA.productMaterials, ctx.source)!;\n const noun = pick(COMMERCE_DATA.productNouns, ctx.source)!;\n const department = pick(COMMERCE_DATA.departments, ctx.source)!;\n\n parts.push(\n `The ${adjective.toLowerCase()} ${material.toLowerCase()} ${noun.toLowerCase()} is a great choice for your ${department.toLowerCase()} needs.`,\n );\n }\n\n return parts.join(' ');\n}\n"],"mappings":";;;;;;;;;;;;;;;IAQM,IAAsD;CAAE;CAAK;CAAK;AAAI;AAQ5E,SAAgB,EAAiB,GAAiC;CAChE,OAAO,EAAK,EAAc,mBAAmB,EAAI,MAAM;AACzD;AAEA,SAAgB,EAAgB,GAAiC;CAC/D,OAAO,EAAK,EAAc,kBAAkB,EAAI,MAAM;AACxD;AAEA,SAAgB,EAAY,GAAiC;CAC3D,OAAO,EAAK,EAAc,cAAc,EAAI,MAAM;AACpD;AAEA,SAAgB,EAAY,GAAiC;CAC3D,OAAO,GAAG,EAAiB,CAAG,EAAE,GAAG,EAAgB,CAAG,EAAE,GAAG,EAAY,CAAG;AAC5E;AAEA,SAAgB,EAAW,GAAiC;CAC1D,OAAO,EAAK,EAAc,aAAa,EAAI,MAAM;AACnD;AAEA,SAAgB,EAAM,GAAyB,IAAqB,CAAC,GAAU;CAC7E,IAAM,IAAM,EAAK,OAAO,KAClB,IAAM,EAAK,OAAO,KAClB,IAAO,EAAK,YAAY,OACxB,IAAS,EAAW,GAAK,GAAK,GAAG,EAAI,MAAM;CAEjD,OAAO,EAAM,EAAO,QAAQ,CAAC,GAAG,EAAW,EAAK;AAClD;AAEA,SAAgB,EAAmB,GAAiC;CAClE,IAAM,IAAY,EAAI,GAAG,GAAG,EAAI,MAAM,GAChC,IAAkB,CAAC;CAEzB,KAAK,IAAI,IAAI,GAAG,IAAI,GAAW,KAAK;EAClC,IAAM,IAAY,EAAK,EAAc,mBAAmB,EAAI,MAAM,GAC5D,IAAW,EAAK,EAAc,kBAAkB,EAAI,MAAM,GAC1D,IAAO,EAAK,EAAc,cAAc,EAAI,MAAM,GAClD,IAAa,EAAK,EAAc,aAAa,EAAI,MAAM;EAE7D,EAAM,KACJ,OAAO,EAAU,YAAY,EAAE,GAAG,EAAS,YAAY,EAAE,GAAG,EAAK,YAAY,EAAE,8BAA8B,EAAW,YAAY,EAAE,QACxI;CACF;CAEA,OAAO,EAAM,KAAK,GAAG;AACvB"}
1
+ {"version":3,"file":"commerce.js","names":[],"sources":["../../src/commerce/commerce.ts"],"sourcesContent":["import { type Currency, EUR, GBP, type Money, money, USD } from '@vielzeug/coins';\n\nimport { floatFixed } from '../_helpers/float';\nimport { int } from '../_helpers/int';\nimport { pick } from '../_helpers/string';\nimport type { IllusionistContext } from '../types';\nimport { COMMERCE_DATA } from './data';\n\nconst CURRENCIES: Record<'USD' | 'EUR' | 'GBP', Currency> = { EUR, GBP, USD };\n\nexport type PriceOptions = {\n readonly min?: number;\n readonly max?: number;\n readonly currency?: 'USD' | 'EUR' | 'GBP';\n};\n\nexport function productAdjective(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.productAdjectives, ctx.source)!;\n}\n\nexport function productMaterial(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.productMaterials, ctx.source)!;\n}\n\nexport function productNoun(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.productNouns, ctx.source)!;\n}\n\nexport function productName(ctx: IllusionistContext): string {\n return `${productAdjective(ctx)} ${productMaterial(ctx)} ${productNoun(ctx)}`;\n}\n\nexport function department(ctx: IllusionistContext): string {\n return pick(COMMERCE_DATA.departments, ctx.source)!;\n}\n\nexport function price(ctx: IllusionistContext, opts: PriceOptions = {}): Money {\n const min = opts.min ?? 0.01;\n const max = opts.max ?? 1000;\n const code = opts.currency ?? 'USD';\n const amount = floatFixed(min, max, 2, ctx.source);\n\n return money(amount.toFixed(2), CURRENCIES[code]);\n}\n\nexport function productDescription(ctx: IllusionistContext): string {\n const sentences = int(1, 2, ctx.source);\n const parts: string[] = [];\n\n for (let i = 0; i < sentences; i++) {\n const adjective = pick(COMMERCE_DATA.productAdjectives, ctx.source)!;\n const material = pick(COMMERCE_DATA.productMaterials, ctx.source)!;\n const noun = pick(COMMERCE_DATA.productNouns, ctx.source)!;\n const department = pick(COMMERCE_DATA.departments, ctx.source)!;\n\n parts.push(\n `The ${adjective.toLowerCase()} ${material.toLowerCase()} ${noun.toLowerCase()} is a great choice for your ${department.toLowerCase()} needs.`,\n );\n }\n\n return parts.join(' ');\n}\n"],"mappings":"qhBAQM,EAAsD,CAAE,MAAK,MAAK,KAAI,EAQ5E,SAAgB,iBAAiB,EAAiC,CAChE,OAAO,EAAK,EAAc,kBAAmB,EAAI,MAAM,CACzD,CAEA,SAAgB,gBAAgB,EAAiC,CAC/D,OAAO,EAAK,EAAc,iBAAkB,EAAI,MAAM,CACxD,CAEA,SAAgB,YAAY,EAAiC,CAC3D,OAAO,EAAK,EAAc,aAAc,EAAI,MAAM,CACpD,CAEA,SAAgB,YAAY,EAAiC,CAC3D,MAAO,GAAG,iBAAiB,CAAG,EAAE,GAAG,gBAAgB,CAAG,EAAE,GAAG,YAAY,CAAG,GAC5E,CAEA,SAAgB,WAAW,EAAiC,CAC1D,OAAO,EAAK,EAAc,YAAa,EAAI,MAAM,CACnD,CAEA,SAAgB,MAAM,EAAyB,EAAqB,CAAC,EAAU,CAC7E,IAAM,EAAM,EAAK,KAAO,IAClB,EAAM,EAAK,KAAO,IAClB,EAAO,EAAK,UAAY,MACxB,EAAS,EAAW,EAAK,EAAK,EAAG,EAAI,MAAM,EAEjD,OAAO,EAAM,EAAO,QAAQ,CAAC,EAAG,EAAW,EAAK,CAClD,CAEA,SAAgB,mBAAmB,EAAiC,CAClE,IAAM,EAAY,EAAI,EAAG,EAAG,EAAI,MAAM,EAChC,EAAkB,CAAC,EAEzB,IAAK,IAAI,EAAI,EAAG,EAAI,EAAW,IAAK,CAClC,IAAM,EAAY,EAAK,EAAc,kBAAmB,EAAI,MAAM,EAC5D,EAAW,EAAK,EAAc,iBAAkB,EAAI,MAAM,EAC1D,EAAO,EAAK,EAAc,aAAc,EAAI,MAAM,EAClD,EAAa,EAAK,EAAc,YAAa,EAAI,MAAM,EAE7D,EAAM,KACJ,OAAO,EAAU,YAAY,EAAE,GAAG,EAAS,YAAY,EAAE,GAAG,EAAK,YAAY,EAAE,8BAA8B,EAAW,YAAY,EAAE,QACxI,CACF,CAEA,OAAO,EAAM,KAAK,GAAG,CACvB"}
@@ -1,83 +1,2 @@
1
- //#region src/commerce/data.ts
2
- var e = {
3
- departments: [
4
- "Books",
5
- "Movies",
6
- "Music",
7
- "Games",
8
- "Electronics",
9
- "Computers",
10
- "Home",
11
- "Garden",
12
- "Tools",
13
- "Grocery",
14
- "Health",
15
- "Beauty",
16
- "Toys",
17
- "Kids",
18
- "Baby",
19
- "Clothing",
20
- "Shoes",
21
- "Jewelry",
22
- "Sports",
23
- "Outdoors",
24
- "Automotive"
25
- ],
26
- productAdjectives: [
27
- "Small",
28
- "Ergonomic",
29
- "Rustic",
30
- "Intelligent",
31
- "Gorgeous",
32
- "Incredible",
33
- "Fantastic",
34
- "Practical",
35
- "Sleek",
36
- "Awesome",
37
- "Generic",
38
- "Handmade",
39
- "Licensed",
40
- "Refined",
41
- "Unbranded",
42
- "Tasty"
43
- ],
44
- productMaterials: [
45
- "Steel",
46
- "Wooden",
47
- "Concrete",
48
- "Plastic",
49
- "Cotton",
50
- "Granite",
51
- "Rubber",
52
- "Metal",
53
- "Soft",
54
- "Fresh",
55
- "Frozen"
56
- ],
57
- productNouns: [
58
- "Chair",
59
- "Car",
60
- "Computer",
61
- "Gloves",
62
- "Pants",
63
- "Shirt",
64
- "Table",
65
- "Shoes",
66
- "Hat",
67
- "Plate",
68
- "Knife",
69
- "Bottle",
70
- "Coat",
71
- "Lamp",
72
- "Keyboard",
73
- "Bag",
74
- "Bench",
75
- "Clock",
76
- "Watch",
77
- "Wallet"
78
- ]
79
- };
80
- //#endregion
81
- export { e as COMMERCE_DATA };
82
-
1
+ var e={departments:[`Books`,`Movies`,`Music`,`Games`,`Electronics`,`Computers`,`Home`,`Garden`,`Tools`,`Grocery`,`Health`,`Beauty`,`Toys`,`Kids`,`Baby`,`Clothing`,`Shoes`,`Jewelry`,`Sports`,`Outdoors`,`Automotive`],productAdjectives:[`Small`,`Ergonomic`,`Rustic`,`Intelligent`,`Gorgeous`,`Incredible`,`Fantastic`,`Practical`,`Sleek`,`Awesome`,`Generic`,`Handmade`,`Licensed`,`Refined`,`Unbranded`,`Tasty`],productMaterials:[`Steel`,`Wooden`,`Concrete`,`Plastic`,`Cotton`,`Granite`,`Rubber`,`Metal`,`Soft`,`Fresh`,`Frozen`],productNouns:[`Chair`,`Car`,`Computer`,`Gloves`,`Pants`,`Shirt`,`Table`,`Shoes`,`Hat`,`Plate`,`Knife`,`Bottle`,`Coat`,`Lamp`,`Keyboard`,`Bag`,`Bench`,`Clock`,`Watch`,`Wallet`]};export{e as COMMERCE_DATA};
83
2
  //# sourceMappingURL=data.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"data.js","names":[],"sources":["../../src/commerce/data.ts"],"sourcesContent":["export const COMMERCE_DATA = {\n departments: [\n 'Books',\n 'Movies',\n 'Music',\n 'Games',\n 'Electronics',\n 'Computers',\n 'Home',\n 'Garden',\n 'Tools',\n 'Grocery',\n 'Health',\n 'Beauty',\n 'Toys',\n 'Kids',\n 'Baby',\n 'Clothing',\n 'Shoes',\n 'Jewelry',\n 'Sports',\n 'Outdoors',\n 'Automotive',\n ],\n productAdjectives: [\n 'Small',\n 'Ergonomic',\n 'Rustic',\n 'Intelligent',\n 'Gorgeous',\n 'Incredible',\n 'Fantastic',\n 'Practical',\n 'Sleek',\n 'Awesome',\n 'Generic',\n 'Handmade',\n 'Licensed',\n 'Refined',\n 'Unbranded',\n 'Tasty',\n ],\n productMaterials: [\n 'Steel',\n 'Wooden',\n 'Concrete',\n 'Plastic',\n 'Cotton',\n 'Granite',\n 'Rubber',\n 'Metal',\n 'Soft',\n 'Fresh',\n 'Frozen',\n ],\n productNouns: [\n 'Chair',\n 'Car',\n 'Computer',\n 'Gloves',\n 'Pants',\n 'Shirt',\n 'Table',\n 'Shoes',\n 'Hat',\n 'Plate',\n 'Knife',\n 'Bottle',\n 'Coat',\n 'Lamp',\n 'Keyboard',\n 'Bag',\n 'Bench',\n 'Clock',\n 'Watch',\n 'Wallet',\n ],\n} as const;\n"],"mappings":";AAAA,IAAa,IAAgB;CAC3B,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,mBAAmB;EACjB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,kBAAkB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,cAAc;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"data.js","names":[],"sources":["../../src/commerce/data.ts"],"sourcesContent":["export const COMMERCE_DATA = {\n departments: [\n 'Books',\n 'Movies',\n 'Music',\n 'Games',\n 'Electronics',\n 'Computers',\n 'Home',\n 'Garden',\n 'Tools',\n 'Grocery',\n 'Health',\n 'Beauty',\n 'Toys',\n 'Kids',\n 'Baby',\n 'Clothing',\n 'Shoes',\n 'Jewelry',\n 'Sports',\n 'Outdoors',\n 'Automotive',\n ],\n productAdjectives: [\n 'Small',\n 'Ergonomic',\n 'Rustic',\n 'Intelligent',\n 'Gorgeous',\n 'Incredible',\n 'Fantastic',\n 'Practical',\n 'Sleek',\n 'Awesome',\n 'Generic',\n 'Handmade',\n 'Licensed',\n 'Refined',\n 'Unbranded',\n 'Tasty',\n ],\n productMaterials: [\n 'Steel',\n 'Wooden',\n 'Concrete',\n 'Plastic',\n 'Cotton',\n 'Granite',\n 'Rubber',\n 'Metal',\n 'Soft',\n 'Fresh',\n 'Frozen',\n ],\n productNouns: [\n 'Chair',\n 'Car',\n 'Computer',\n 'Gloves',\n 'Pants',\n 'Shirt',\n 'Table',\n 'Shoes',\n 'Hat',\n 'Plate',\n 'Knife',\n 'Bottle',\n 'Coat',\n 'Lamp',\n 'Keyboard',\n 'Bag',\n 'Bench',\n 'Clock',\n 'Watch',\n 'Wallet',\n ],\n} as const;\n"],"mappings":"AAAA,IAAa,EAAgB,CAC3B,YAAa,CACX,QACA,SACA,QACA,QACA,cACA,YACA,OACA,SACA,QACA,UACA,SACA,SACA,OACA,OACA,OACA,WACA,QACA,UACA,SACA,WACA,YACF,EACA,kBAAmB,CACjB,QACA,YACA,SACA,cACA,WACA,aACA,YACA,YACA,QACA,UACA,UACA,WACA,WACA,UACA,YACA,OACF,EACA,iBAAkB,CAChB,QACA,SACA,WACA,UACA,SACA,UACA,SACA,QACA,OACA,QACA,QACF,EACA,aAAc,CACZ,QACA,MACA,WACA,SACA,QACA,QACA,QACA,QACA,MACA,QACA,QACA,SACA,OACA,OACA,WACA,MACA,QACA,QACA,QACA,QACF,CACF"}
@@ -1,2 +1,2 @@
1
- const e=require("../_virtual/_rolldown/runtime.cjs"),t=require("../_helpers/int.cjs");let n=require("@vielzeug/tempo");var r=e.__exportAll({between:()=>c,birthday:()=>l,future:()=>o,month:()=>d,past:()=>a,recent:()=>s,weekday:()=>u});function i(e){return e??n.Temporal.Now.zonedDateTimeISO(`UTC`)}function a(e,r){let a=i(r?.ref),o=(r?.years??1)*365*24*60*60;return(0,n.shift)(a,{seconds:-t.int(1,o,e.source)})}function o(e,r){let a=i(r?.ref),o=(r?.years??1)*365*24*60*60;return(0,n.shift)(a,{seconds:t.int(1,o,e.source)})}function s(e,r){let a=i(r?.ref),o=(r?.days??1)*24*60*60;return(0,n.shift)(a,{seconds:-t.int(1,o,e.source)})}function c(e,t,n){let r=t.toInstant().epochNanoseconds,i=n.toInstant().epochNanoseconds;if(r>i)return t;let a=i-r,o=Number(a/1000000000n),s=Math.floor(e.source.next()*o);return t.add({seconds:s})}function l(e,n){let r=i(n?.ref),a=n?.minAge??18,o=n?.maxAge??80,s=t.int(a,o,e.source),c=t.int(1,12,e.source),l=t.int(1,28,e.source);return r.toPlainDate().subtract({years:s}).with({day:l,month:c})}function u(e,n){return((n??e.locale.code)===`de`?[`Montag`,`Dienstag`,`Mittwoch`,`Donnerstag`,`Freitag`,`Samstag`,`Sonntag`]:[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`])[t.int(0,6,e.source)]}function d(e,n){return((n??e.locale.code)===`de`?[`Januar`,`Februar`,`März`,`April`,`Mai`,`Juni`,`Juli`,`August`,`September`,`Oktober`,`November`,`Dezember`]:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`])[t.int(0,11,e.source)]}exports.between=c,exports.birthday=l,Object.defineProperty(exports,"date_exports",{enumerable:!0,get:function(){return r}}),exports.future=o,exports.month=d,exports.past=a,exports.recent=s,exports.weekday=u;
1
+ const e=require("../_virtual/_rolldown/runtime.cjs"),t=require("../_helpers/int.cjs");let n=require("@vielzeug/tempo");var r=e.__exportAll({between:()=>between,birthday:()=>birthday,future:()=>future,month:()=>month,past:()=>past,recent:()=>recent,weekday:()=>weekday});function resolveRef(e){return e??n.Temporal.Now.zonedDateTimeISO(`UTC`)}function past(e,n){let r=resolveRef(n?.ref),i=(n?.years??1)*365*24*60*60;return r.add({seconds:-t.int(1,i,e.source)})}function future(e,n){let r=resolveRef(n?.ref),i=(n?.years??1)*365*24*60*60;return r.add({seconds:t.int(1,i,e.source)})}function recent(e,n){let r=resolveRef(n?.ref),i=(n?.days??1)*24*60*60;return r.add({seconds:-t.int(1,i,e.source)})}function between(e,t,n){let r=t.toInstant().epochNanoseconds,i=n.toInstant().epochNanoseconds;if(r>i)return t;let a=i-r,o=Number(a/1000000000n),s=Math.floor(e.source.next()*o);return t.add({seconds:s})}function birthday(e,n){let r=resolveRef(n?.ref),i=n?.minAge??18,a=n?.maxAge??80,o=t.int(i,a,e.source),s=t.int(1,12,e.source),c=t.int(1,28,e.source);return r.toPlainDate().subtract({years:o}).with({day:c,month:s})}function weekday(e,n){return((n??e.locale.code)===`de`?[`Montag`,`Dienstag`,`Mittwoch`,`Donnerstag`,`Freitag`,`Samstag`,`Sonntag`]:[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`])[t.int(0,6,e.source)]}function month(e,n){return((n??e.locale.code)===`de`?[`Januar`,`Februar`,`März`,`April`,`Mai`,`Juni`,`Juli`,`August`,`September`,`Oktober`,`November`,`Dezember`]:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`])[t.int(0,11,e.source)]}exports.between=between,exports.birthday=birthday,Object.defineProperty(exports,"date_exports",{enumerable:!0,get:function(){return r}}),exports.future=future,exports.month=month,exports.past=past,exports.recent=recent,exports.weekday=weekday;
2
2
  //# sourceMappingURL=date.cjs.map