@dxos/random 0.10.0 → 0.11.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.
@@ -1,587 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
-
3
- // src/index.ts
4
- export * from "@ngneat/falso";
5
-
6
- // src/random.ts
7
- import { rand, randChanceBoolean, randCompanyName, randEmail, randFirstName, randFloat, randFullName, randHexaDecimal, randImg, randNumber as randNumber2, randParagraph, randProductName, randRecentDate, randSentence, randUrl, randUuid, randWord, seed } from "@ngneat/falso";
8
- import { idEmoji, idHue } from "@dxos/util";
9
-
10
- // src/data.ts
11
- var airports = [
12
- {
13
- name: "Atlanta",
14
- code: "ATL",
15
- location: [
16
- -84.4277,
17
- 33.6407
18
- ]
19
- },
20
- {
21
- name: "Dubai",
22
- code: "DXB",
23
- location: [
24
- 55.3644,
25
- 25.2532
26
- ]
27
- },
28
- {
29
- name: "Dallas",
30
- code: "DFW",
31
- location: [
32
- -97.0403,
33
- 32.8998
34
- ]
35
- },
36
- {
37
- name: "London",
38
- code: "LHR",
39
- location: [
40
- -0.4543,
41
- 51.47
42
- ]
43
- },
44
- {
45
- name: "Tokyo",
46
- code: "HND",
47
- location: [
48
- 139.7811,
49
- 35.5494
50
- ]
51
- },
52
- {
53
- name: "Denver",
54
- code: "DEN",
55
- location: [
56
- -104.6737,
57
- 39.8561
58
- ]
59
- },
60
- {
61
- name: "Istanbul",
62
- code: "IST",
63
- location: [
64
- 28.8153,
65
- 41.2753
66
- ]
67
- },
68
- {
69
- name: "Los Angeles",
70
- code: "LAX",
71
- location: [
72
- -118.4085,
73
- 33.9416
74
- ]
75
- },
76
- {
77
- name: "Paris",
78
- code: "CDG",
79
- location: [
80
- 2.55,
81
- 49.0097
82
- ]
83
- },
84
- {
85
- name: "Guangzhou",
86
- code: "CAN",
87
- location: [
88
- 113.2971,
89
- 23.3924
90
- ]
91
- },
92
- {
93
- name: "Frankfurt",
94
- code: "FRA",
95
- location: [
96
- 8.5706,
97
- 50.0333
98
- ]
99
- },
100
- {
101
- name: "Delhi",
102
- code: "DEL",
103
- location: [
104
- 77.1031,
105
- 28.5562
106
- ]
107
- },
108
- {
109
- name: "Singapore",
110
- code: "SIN",
111
- location: [
112
- 103.994,
113
- 1.3644
114
- ]
115
- },
116
- {
117
- name: "Amsterdam",
118
- code: "AMS",
119
- location: [
120
- 4.7639,
121
- 52.3105
122
- ]
123
- },
124
- {
125
- name: "Seoul",
126
- code: "ICN",
127
- location: [
128
- 126.4505,
129
- 37.4602
130
- ]
131
- },
132
- {
133
- name: "Jakarta",
134
- code: "CGK",
135
- location: [
136
- 106.6559,
137
- -6.1256
138
- ]
139
- },
140
- {
141
- name: "Bangkok",
142
- code: "BKK",
143
- location: [
144
- 100.7501,
145
- 13.6899
146
- ]
147
- },
148
- {
149
- name: "Hong Kong",
150
- code: "HKG",
151
- location: [
152
- 113.9185,
153
- 22.308
154
- ]
155
- },
156
- {
157
- name: "Madrid",
158
- code: "MAD",
159
- location: [
160
- -3.5676,
161
- 40.4936
162
- ]
163
- },
164
- {
165
- name: "San Francisco",
166
- code: "SFO",
167
- location: [
168
- -122.379,
169
- 37.6213
170
- ]
171
- },
172
- {
173
- name: "New York",
174
- code: "JFK",
175
- location: [
176
- -73.7781,
177
- 40.6413
178
- ]
179
- },
180
- {
181
- name: "Chicago",
182
- code: "ORD",
183
- location: [
184
- -87.9048,
185
- 41.9742
186
- ]
187
- },
188
- {
189
- name: "Shanghai",
190
- code: "PVG",
191
- location: [
192
- 121.8083,
193
- 31.1434
194
- ]
195
- },
196
- {
197
- name: "Beijing",
198
- code: "PEK",
199
- location: [
200
- 116.4074,
201
- 39.9042
202
- ]
203
- },
204
- {
205
- name: "Miami",
206
- code: "MIA",
207
- location: [
208
- -80.2906,
209
- 25.7959
210
- ]
211
- },
212
- {
213
- name: "Houston",
214
- code: "IAH",
215
- location: [
216
- -95.3414,
217
- 29.9844
218
- ]
219
- },
220
- {
221
- name: "Munich",
222
- code: "MUC",
223
- location: [
224
- 11.7861,
225
- 48.3538
226
- ]
227
- },
228
- {
229
- name: "Toronto",
230
- code: "YYZ",
231
- location: [
232
- -79.6306,
233
- 43.6777
234
- ]
235
- },
236
- {
237
- name: "Sydney",
238
- code: "SYD",
239
- location: [
240
- 151.1799,
241
- -33.9399
242
- ]
243
- },
244
- {
245
- name: "Melbourne",
246
- code: "MEL",
247
- location: [
248
- 144.843,
249
- -37.6733
250
- ]
251
- },
252
- {
253
- name: "Rome",
254
- code: "FCO",
255
- location: [
256
- 12.2508,
257
- 41.8003
258
- ]
259
- },
260
- {
261
- name: "Barcelona",
262
- code: "BCN",
263
- location: [
264
- 2.0759,
265
- 41.2974
266
- ]
267
- },
268
- {
269
- name: "Kuala Lumpur",
270
- code: "KUL",
271
- location: [
272
- 101.7099,
273
- 2.7456
274
- ]
275
- },
276
- {
277
- name: "Doha",
278
- code: "DOH",
279
- location: [
280
- 51.6136,
281
- 25.2731
282
- ]
283
- },
284
- {
285
- name: "Vienna",
286
- code: "VIE",
287
- location: [
288
- 16.5697,
289
- 48.1103
290
- ]
291
- },
292
- {
293
- name: "Zurich",
294
- code: "ZRH",
295
- location: [
296
- 8.5492,
297
- 47.4583
298
- ]
299
- },
300
- {
301
- name: "Brussels",
302
- code: "BRU",
303
- location: [
304
- 4.4844,
305
- 50.901
306
- ]
307
- },
308
- {
309
- name: "Copenhagen",
310
- code: "CPH",
311
- location: [
312
- 12.6508,
313
- 55.6181
314
- ]
315
- },
316
- {
317
- name: "Oslo",
318
- code: "OSL",
319
- location: [
320
- 11.1004,
321
- 60.1939
322
- ]
323
- },
324
- {
325
- name: "Stockholm",
326
- code: "ARN",
327
- location: [
328
- 17.9186,
329
- 59.6519
330
- ]
331
- },
332
- {
333
- name: "Helsinki",
334
- code: "HEL",
335
- location: [
336
- 24.9633,
337
- 60.3172
338
- ]
339
- },
340
- {
341
- name: "Lisbon",
342
- code: "LIS",
343
- location: [
344
- -9.1359,
345
- 38.7742
346
- ]
347
- },
348
- {
349
- name: "Athens",
350
- code: "ATH",
351
- location: [
352
- 23.9445,
353
- 37.9364
354
- ]
355
- },
356
- {
357
- name: "Warsaw",
358
- code: "WAW",
359
- location: [
360
- 20.9671,
361
- 52.1657
362
- ]
363
- },
364
- {
365
- name: "Budapest",
366
- code: "BUD",
367
- location: [
368
- 19.261,
369
- 47.433
370
- ]
371
- },
372
- {
373
- name: "Prague",
374
- code: "PRG",
375
- location: [
376
- 14.2632,
377
- 50.1008
378
- ]
379
- },
380
- {
381
- name: "Moscow",
382
- code: "SVO",
383
- location: [
384
- 37.4146,
385
- 55.9726
386
- ]
387
- },
388
- {
389
- name: "Dubai",
390
- code: "DXB",
391
- location: [
392
- 55.3644,
393
- 25.2532
394
- ]
395
- }
396
- ];
397
- var icons = [
398
- "ph--air-traffic-control--regular",
399
- "ph--asterisk--regular",
400
- "ph--atom--regular",
401
- "ph--basketball--regular",
402
- "ph--butterfly--regular",
403
- "ph--cactus--regular",
404
- "ph--cake--regular",
405
- "ph--calendar-dots--regular",
406
- "ph--campfire--regular",
407
- "ph--command--regular",
408
- "ph--confetti--regular",
409
- "ph--detective--regular",
410
- "ph--disco-ball--regular",
411
- "ph--dna--regular",
412
- "ph--factory--regular",
413
- "ph--flag-banner-fold--regular",
414
- "ph--flask--regular",
415
- "ph--flower-lotus--regular",
416
- "ph--flying-saucer--regular",
417
- "ph--game-controller--regular",
418
- "ph--gavel--regular",
419
- "ph--gift--regular",
420
- "ph--guitar--regular",
421
- "ph--hamburger--regular",
422
- "ph--handshake--regular",
423
- "ph--heart--regular",
424
- "ph--lightbulb--regular",
425
- "ph--lock--regular",
426
- "ph--martini--regular",
427
- "ph--medal-military--regular",
428
- "ph--moped-front--regular",
429
- "ph--office-chair--regular",
430
- "ph--paint-brush-household--regular",
431
- "ph--peace--regular",
432
- "ph--person-simple-hike--regular",
433
- "ph--piggy-bank--regular",
434
- "ph--potted-plant--regular",
435
- "ph--radioactive--regular",
436
- "ph--rocket-launch--regular",
437
- "ph--shield-star--regular",
438
- "ph--shopping-cart--regular",
439
- "ph--stethoscope--regular",
440
- "ph--student--regular",
441
- "ph--sun--regular",
442
- "ph--tote--regular",
443
- "ph--tree--regular",
444
- "ph--users-three--regular",
445
- "ph--yin-yang--regular"
446
- ];
447
-
448
- // src/util.ts
449
- import { randNumber } from "@ngneat/falso";
450
- var toRange = (range, min = 0) => typeof range === "number" ? {
451
- min,
452
- max: range
453
- } : range;
454
- var getCount = (range) => typeof range === "number" ? range : randNumber(range);
455
- var multiple = (fn, n) => {
456
- return Array.from({
457
- length: n
458
- }).map((_, i) => fn(i));
459
- };
460
- var uniqueArray = (values, n) => {
461
- if (Array.isArray(values)) {
462
- const results = [];
463
- const selection = Array.from(new Set(values));
464
- for (let i = 0; i < n; i++) {
465
- if (selection.length === 0) {
466
- break;
467
- }
468
- results.push(selection.splice(Math.floor(Math.random() * selection.length), 1)[0]);
469
- }
470
- return results;
471
- } else {
472
- const results = /* @__PURE__ */ new Set();
473
- while (results.size < n) {
474
- results.add(values());
475
- }
476
- return Array.from(results);
477
- }
478
- };
479
-
480
- // src/random.ts
481
- var random = {
482
- //
483
- // Util
484
- //
485
- seed: (value) => seed(String(value)),
486
- helpers: {
487
- arrayElement: (a) => rand(a),
488
- multiple: (f, { count }) => multiple(f, typeof count === "number" ? count : getCount(count)),
489
- uniqueArray: (f, n) => uniqueArray(f, n),
490
- randomSubset: (array, count) => {
491
- const length = count === void 0 ? Math.floor(Math.random() * (array.length + 1)) : Math.min(typeof count === "number" ? count : getCount(count), array.length);
492
- if (length === 0) {
493
- return [];
494
- }
495
- return uniqueArray(() => rand(array), length);
496
- }
497
- },
498
- //
499
- // Type
500
- //
501
- number: {
502
- float: (range) => randFloat(range ? toRange(range) : void 0),
503
- int: (range) => randNumber2(range ? toRange(range) : void 0)
504
- },
505
- datatype: {
506
- boolean: (p) => randChanceBoolean({
507
- chanceTrue: p?.probability ?? 0.5
508
- })
509
- },
510
- date: {
511
- recent: () => randRecentDate(),
512
- iso8601: () => randRecentDate().toISOString()
513
- },
514
- image: {
515
- url: () => randImg()
516
- },
517
- //
518
- // Text
519
- //
520
- lorem: {
521
- word: () => randWord(),
522
- words: (n = 1) => randWord({
523
- length: getCount(n)
524
- }).join(" "),
525
- sentence: (n = 1) => {
526
- if (n) {
527
- const text = randWord({
528
- length: getCount(n)
529
- }).join(" ");
530
- return text.charAt(0).toUpperCase() + text.slice(1) + ".";
531
- }
532
- return randSentence();
533
- },
534
- sentences: (n = 1) => randSentence({
535
- length: getCount(n)
536
- }).join(" "),
537
- paragraph: (n = 1) => {
538
- if (n) {
539
- return randSentence({
540
- length: getCount(n)
541
- }).join(" ");
542
- }
543
- return randParagraph();
544
- },
545
- paragraphs: (n = 1) => randParagraph({
546
- length: getCount(n)
547
- }).join("\n")
548
- },
549
- //
550
- // String
551
- //
552
- string: {
553
- hexadecimal: (l) => randHexaDecimal(l).join(""),
554
- uuid: () => randUuid()
555
- },
556
- //
557
- // Custom
558
- //
559
- internet: {
560
- email: () => randEmail(),
561
- url: () => randUrl()
562
- },
563
- person: {
564
- firstName: () => randFirstName(),
565
- fullName: () => randFullName()
566
- },
567
- company: {
568
- name: () => randCompanyName()
569
- },
570
- commerce: {
571
- productName: () => randProductName()
572
- },
573
- geo: {
574
- airport: () => rand(airports),
575
- location: () => rand(airports).location
576
- },
577
- email: {},
578
- properties: {
579
- emoji: () => rand(idEmoji),
580
- hue: () => rand(idHue),
581
- icon: () => rand(icons)
582
- }
583
- };
584
- export {
585
- random
586
- };
587
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/index.ts", "../../../src/random.ts", "../../../src/data.ts", "../../../src/util.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nexport * from '@ngneat/falso';\n\nexport { random } from './random';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport {\n rand,\n randChanceBoolean,\n randCompanyName,\n randEmail,\n randFirstName,\n randFloat,\n randFullName,\n randHexaDecimal,\n randImg,\n randNumber,\n randParagraph,\n randProductName,\n randRecentDate,\n randSentence,\n randUrl,\n randUuid,\n randWord,\n seed,\n} from '@ngneat/falso';\n\nimport { idEmoji, idHue } from '@dxos/util';\n\nimport { airports, icons } from './data';\nimport { type Range, getCount, multiple, toRange, uniqueArray } from './util';\n\nexport const random = {\n //\n // Util\n //\n seed: (value: number) => seed(String(value)),\n helpers: {\n arrayElement: <T>(a: T[]) => rand(a),\n multiple: <T>(f: () => T, { count }: { count: number | { min: number; max: number } }) =>\n multiple(f, typeof count === 'number' ? count : getCount(count)),\n uniqueArray: <T>(f: T[] | (() => T), n: number) => uniqueArray(f, n),\n randomSubset: <T>(array: T[], count?: number | { min: number; max: number }) => {\n const length =\n count === undefined\n ? Math.floor(Math.random() * (array.length + 1))\n : Math.min(typeof count === 'number' ? count : getCount(count), array.length);\n\n if (length === 0) {\n return [];\n }\n return uniqueArray(() => rand(array), length);\n },\n },\n\n //\n // Type\n //\n number: {\n float: (range?: number | Range) => randFloat(range ? toRange(range) : undefined),\n int: (range?: number | Range) => randNumber(range ? toRange(range) : undefined),\n },\n datatype: {\n boolean: (p?: { probability: number }) => randChanceBoolean({ chanceTrue: p?.probability ?? 0.5 }),\n },\n date: {\n recent: () => randRecentDate(),\n iso8601: () => randRecentDate().toISOString(),\n },\n image: {\n url: () => randImg(),\n },\n\n //\n // Text\n //\n lorem: {\n word: () => randWord(),\n words: (n: number | Range = 1) => randWord({ length: getCount(n) }).join(' '),\n sentence: (n: number | Range = 1) => {\n if (n) {\n const text = randWord({ length: getCount(n) }).join(' ');\n return text.charAt(0).toUpperCase() + text.slice(1) + '.';\n }\n\n return randSentence();\n },\n sentences: (n: number | Range = 1) => randSentence({ length: getCount(n) }).join(' '),\n paragraph: (n: number | Range = 1) => {\n if (n) {\n return randSentence({ length: getCount(n) }).join(' ');\n }\n\n return randParagraph();\n },\n paragraphs: (n: number | Range = 1) => randParagraph({ length: getCount(n) }).join('\\n'),\n },\n\n //\n // String\n //\n string: {\n hexadecimal: (l?: { length: number }) => randHexaDecimal(l).join(''),\n uuid: () => randUuid(),\n },\n\n //\n // Custom\n //\n internet: {\n email: () => randEmail(),\n url: () => randUrl(),\n },\n person: {\n firstName: () => randFirstName(),\n fullName: () => randFullName(),\n },\n company: {\n name: () => randCompanyName(),\n },\n commerce: {\n productName: () => randProductName(),\n },\n geo: {\n airport: () => rand(airports),\n location: () => rand(airports).location,\n },\n email: {},\n properties: {\n emoji: () => rand(idEmoji),\n hue: () => rand(idHue),\n icon: () => rand(icons),\n },\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nexport const airports = [\n { name: 'Atlanta', code: 'ATL', location: [-84.4277, 33.6407] },\n { name: 'Dubai', code: 'DXB', location: [55.3644, 25.2532] },\n { name: 'Dallas', code: 'DFW', location: [-97.0403, 32.8998] },\n { name: 'London', code: 'LHR', location: [-0.4543, 51.47] },\n { name: 'Tokyo', code: 'HND', location: [139.7811, 35.5494] },\n { name: 'Denver', code: 'DEN', location: [-104.6737, 39.8561] },\n { name: 'Istanbul', code: 'IST', location: [28.8153, 41.2753] },\n { name: 'Los Angeles', code: 'LAX', location: [-118.4085, 33.9416] },\n { name: 'Paris', code: 'CDG', location: [2.55, 49.0097] },\n { name: 'Guangzhou', code: 'CAN', location: [113.2971, 23.3924] },\n { name: 'Frankfurt', code: 'FRA', location: [8.5706, 50.0333] },\n { name: 'Delhi', code: 'DEL', location: [77.1031, 28.5562] },\n { name: 'Singapore', code: 'SIN', location: [103.994, 1.3644] },\n { name: 'Amsterdam', code: 'AMS', location: [4.7639, 52.3105] },\n { name: 'Seoul', code: 'ICN', location: [126.4505, 37.4602] },\n { name: 'Jakarta', code: 'CGK', location: [106.6559, -6.1256] },\n { name: 'Bangkok', code: 'BKK', location: [100.7501, 13.6899] },\n { name: 'Hong Kong', code: 'HKG', location: [113.9185, 22.308] },\n { name: 'Madrid', code: 'MAD', location: [-3.5676, 40.4936] },\n { name: 'San Francisco', code: 'SFO', location: [-122.379, 37.6213] },\n { name: 'New York', code: 'JFK', location: [-73.7781, 40.6413] },\n { name: 'Chicago', code: 'ORD', location: [-87.9048, 41.9742] },\n { name: 'Shanghai', code: 'PVG', location: [121.8083, 31.1434] },\n { name: 'Beijing', code: 'PEK', location: [116.4074, 39.9042] },\n { name: 'Miami', code: 'MIA', location: [-80.2906, 25.7959] },\n { name: 'Houston', code: 'IAH', location: [-95.3414, 29.9844] },\n { name: 'Munich', code: 'MUC', location: [11.7861, 48.3538] },\n { name: 'Toronto', code: 'YYZ', location: [-79.6306, 43.6777] },\n { name: 'Sydney', code: 'SYD', location: [151.1799, -33.9399] },\n { name: 'Melbourne', code: 'MEL', location: [144.843, -37.6733] },\n { name: 'Rome', code: 'FCO', location: [12.2508, 41.8003] },\n { name: 'Barcelona', code: 'BCN', location: [2.0759, 41.2974] },\n { name: 'Kuala Lumpur', code: 'KUL', location: [101.7099, 2.7456] },\n { name: 'Doha', code: 'DOH', location: [51.6136, 25.2731] },\n { name: 'Vienna', code: 'VIE', location: [16.5697, 48.1103] },\n { name: 'Zurich', code: 'ZRH', location: [8.5492, 47.4583] },\n { name: 'Brussels', code: 'BRU', location: [4.4844, 50.901] },\n { name: 'Copenhagen', code: 'CPH', location: [12.6508, 55.6181] },\n { name: 'Oslo', code: 'OSL', location: [11.1004, 60.1939] },\n { name: 'Stockholm', code: 'ARN', location: [17.9186, 59.6519] },\n { name: 'Helsinki', code: 'HEL', location: [24.9633, 60.3172] },\n { name: 'Lisbon', code: 'LIS', location: [-9.1359, 38.7742] },\n { name: 'Athens', code: 'ATH', location: [23.9445, 37.9364] },\n { name: 'Warsaw', code: 'WAW', location: [20.9671, 52.1657] },\n { name: 'Budapest', code: 'BUD', location: [19.261, 47.433] },\n { name: 'Prague', code: 'PRG', location: [14.2632, 50.1008] },\n { name: 'Moscow', code: 'SVO', location: [37.4146, 55.9726] },\n { name: 'Dubai', code: 'DXB', location: [55.3644, 25.2532] },\n];\n\nexport const icons = [\n 'ph--air-traffic-control--regular',\n 'ph--asterisk--regular',\n 'ph--atom--regular',\n 'ph--basketball--regular',\n 'ph--butterfly--regular',\n 'ph--cactus--regular',\n 'ph--cake--regular',\n 'ph--calendar-dots--regular',\n 'ph--campfire--regular',\n 'ph--command--regular',\n 'ph--confetti--regular',\n 'ph--detective--regular',\n 'ph--disco-ball--regular',\n 'ph--dna--regular',\n 'ph--factory--regular',\n 'ph--flag-banner-fold--regular',\n 'ph--flask--regular',\n 'ph--flower-lotus--regular',\n 'ph--flying-saucer--regular',\n 'ph--game-controller--regular',\n 'ph--gavel--regular',\n 'ph--gift--regular',\n 'ph--guitar--regular',\n 'ph--hamburger--regular',\n 'ph--handshake--regular',\n 'ph--heart--regular',\n 'ph--lightbulb--regular',\n 'ph--lock--regular',\n 'ph--martini--regular',\n 'ph--medal-military--regular',\n 'ph--moped-front--regular',\n 'ph--office-chair--regular',\n 'ph--paint-brush-household--regular',\n 'ph--peace--regular',\n 'ph--person-simple-hike--regular',\n 'ph--piggy-bank--regular',\n 'ph--potted-plant--regular',\n 'ph--radioactive--regular',\n 'ph--rocket-launch--regular',\n 'ph--shield-star--regular',\n 'ph--shopping-cart--regular',\n 'ph--stethoscope--regular',\n 'ph--student--regular',\n 'ph--sun--regular',\n 'ph--tote--regular',\n 'ph--tree--regular',\n 'ph--users-three--regular',\n 'ph--yin-yang--regular',\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { randNumber } from '@ngneat/falso';\n\nexport type Range = { min?: number; max?: number; count?: number };\n\nexport const toRange = (range: number | Range, min = 0) => (typeof range === 'number' ? { min, max: range } : range);\n\nexport const getCount = (range?: number | Range) => (typeof range === 'number' ? range : randNumber(range));\n\nexport const multiple = <T>(fn: (i: number) => T, n: number): T[] => {\n return Array.from({ length: n }).map((_, i) => fn(i));\n};\n\nexport const uniqueArray = <T>(values: T[] | (() => T), n: number): T[] => {\n if (Array.isArray(values)) {\n const results: T[] = [];\n const selection = Array.from(new Set<T>(values));\n for (let i = 0; i < n; i++) {\n if (selection.length === 0) {\n break;\n }\n results.push(selection.splice(Math.floor(Math.random() * selection.length), 1)[0]);\n }\n return results;\n } else {\n const results = new Set<T>();\n // TODO(burdon): Set timeout.\n while (results.size < n) {\n results.add(values());\n }\n\n return Array.from(results);\n }\n};\n"],
5
- "mappings": ";;;AAIA,cAAc;;;ACAd,SACEA,MACAC,mBACAC,iBACAC,WACAC,eACAC,WACAC,cACAC,iBACAC,SACAC,cAAAA,aACAC,eACAC,iBACAC,gBACAC,cACAC,SACAC,UACAC,UACAC,YACK;AAEP,SAASC,SAASC,aAAa;;;ACrBxB,IAAMC,WAAW;EACtB;IAAEC,MAAM;IAAWC,MAAM;IAAOC,UAAU;MAAC;MAAU;;EAAS;EAC9D;IAAEF,MAAM;IAASC,MAAM;IAAOC,UAAU;MAAC;MAAS;;EAAS;EAC3D;IAAEF,MAAM;IAAUC,MAAM;IAAOC,UAAU;MAAC;MAAU;;EAAS;EAC7D;IAAEF,MAAM;IAAUC,MAAM;IAAOC,UAAU;MAAC;MAAS;;EAAO;EAC1D;IAAEF,MAAM;IAASC,MAAM;IAAOC,UAAU;MAAC;MAAU;;EAAS;EAC5D;IAAEF,MAAM;IAAUC,MAAM;IAAOC,UAAU;MAAC;MAAW;;EAAS;EAC9D;IAAEF,MAAM;IAAYC,MAAM;IAAOC,UAAU;MAAC;MAAS;;EAAS;EAC9D;IAAEF,MAAM;IAAeC,MAAM;IAAOC,UAAU;MAAC;MAAW;;EAAS;EACnE;IAAEF,MAAM;IAASC,MAAM;IAAOC,UAAU;MAAC;MAAM;;EAAS;EACxD;IAAEF,MAAM;IAAaC,MAAM;IAAOC,UAAU;MAAC;MAAU;;EAAS;EAChE;IAAEF,MAAM;IAAaC,MAAM;IAAOC,UAAU;MAAC;MAAQ;;EAAS;EAC9D;IAAEF,MAAM;IAASC,MAAM;IAAOC,UAAU;MAAC;MAAS;;EAAS;EAC3D;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CAAA,IAAK;MACxD;AAEA,aAAOC,aAAAA;IACT;IACAC,WAAW,CAACxC,IAAoB,MAAMuC,aAAa;MAAEpC,QAAQL,SAASE,CAAAA;IAAG,CAAA,EAAGiC,KAAK,GAAA;IACjFQ,WAAW,CAACzC,IAAoB,MAAC;AAC/B,UAAIA,GAAG;AACL,eAAOuC,aAAa;UAAEpC,QAAQL,SAASE,CAAAA;QAAG,CAAA,EAAGiC,KAAK,GAAA;MACpD;AAEA,aAAOS,cAAAA;IACT;IACAC,YAAY,CAAC3C,IAAoB,MAAM0C,cAAc;MAAEvC,QAAQL,SAASE,CAAAA;IAAG,CAAA,EAAGiC,KAAK,IAAA;EACrF;;;;EAKAW,QAAQ;IACNC,aAAa,CAACC,MAA2BC,gBAAgBD,CAAAA,EAAGb,KAAK,EAAA;IACjEe,MAAM,MAAMC,SAAAA;EACd;;;;EAKAC,UAAU;IACRC,OAAO,MAAMC,UAAAA;IACbzB,KAAK,MAAM0B,QAAAA;EACb;EACAC,QAAQ;IACNC,WAAW,MAAMC,cAAAA;IACjBC,UAAU,MAAMC,aAAAA;EAClB;EACAC,SAAS;IACPC,MAAM,MAAMC,gBAAAA;EACd;EACAC,UAAU;IACRC,aAAa,MAAMC,gBAAAA;EACrB;EACAC,KAAK;IACHC,SAAS,MAAMxE,KAAKyE,QAAAA;IACpBC,UAAU,MAAM1E,KAAKyE,QAAAA,EAAUC;EACjC;EACAjB,OAAO,CAAC;EACRkB,YAAY;IACVC,OAAO,MAAM5E,KAAK6E,OAAAA;IAClBC,KAAK,MAAM9E,KAAK+E,KAAAA;IAChBC,MAAM,MAAMhF,KAAKiF,KAAAA;EACnB;AACF;",
6
- "names": ["rand", "randChanceBoolean", "randCompanyName", "randEmail", "randFirstName", "randFloat", "randFullName", "randHexaDecimal", "randImg", "randNumber", "randParagraph", "randProductName", "randRecentDate", "randSentence", "randUrl", "randUuid", "randWord", "seed", "idEmoji", "idHue", "airports", "name", "code", "location", "icons", "randNumber", "toRange", "range", "min", "max", "getCount", "multiple", "fn", "n", "Array", "from", "length", "map", "_", "i", "uniqueArray", "values", "isArray", "results", "selection", "Set", "push", "splice", "Math", "floor", "random", "size", "add", "random", "seed", "value", "String", "helpers", "arrayElement", "a", "rand", "multiple", "f", "count", "getCount", "uniqueArray", "n", "randomSubset", "array", "length", "undefined", "Math", "floor", "min", "number", "float", "range", "randFloat", "toRange", "int", "randNumber", "datatype", "boolean", "p", "randChanceBoolean", "chanceTrue", "probability", "date", "recent", "randRecentDate", "iso8601", "toISOString", "image", "url", "randImg", "lorem", "word", "randWord", "words", "join", "sentence", "text", "charAt", "toUpperCase", "slice", "randSentence", "sentences", "paragraph", "randParagraph", "paragraphs", "string", "hexadecimal", "l", "randHexaDecimal", "uuid", "randUuid", "internet", "email", "randEmail", "randUrl", "person", "firstName", "randFirstName", "fullName", "randFullName", "company", "name", "randCompanyName", "commerce", "productName", "randProductName", "geo", "airport", "airports", "location", "properties", "emoji", "idEmoji", "hue", "idHue", "icon", "icons"]
7
- }
@@ -1 +0,0 @@
1
- {"inputs":{"src/data.ts":{"bytes":18648,"imports":[],"format":"esm"},"src/util.ts":{"bytes":4117,"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true}],"format":"esm"},"src/random.ts":{"bytes":12200,"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/data.ts","kind":"import-statement","original":"./data"},{"path":"src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"src/index.ts":{"bytes":518,"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"src/random.ts","kind":"import-statement","original":"./random"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":16995},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@ngneat/falso","kind":"import-statement","external":true}],"exports":["random"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":31},"src/random.ts":{"bytesInOutput":2677},"src/data.ts":{"bytesInOutput":6106},"src/util.ts":{"bytesInOutput":827}},"bytes":9874}}}