@dxos/random 0.8.2-main.fbd8ed0 → 0.8.2-staging.7ac8446
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +8 -66
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +7 -65
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +8 -66
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/data.d.ts +2 -3
- package/dist/types/src/data.d.ts.map +1 -1
- package/dist/types/src/faker.d.ts +1 -12
- package/dist/types/src/faker.d.ts.map +1 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -3
- package/src/data.ts +2 -51
- package/src/faker.ts +5 -20
|
@@ -4,8 +4,7 @@ import "@dxos/node-std/globals";
|
|
|
4
4
|
export * from "@ngneat/falso";
|
|
5
5
|
|
|
6
6
|
// packages/common/random/src/faker.ts
|
|
7
|
-
import { rand, randChanceBoolean, randCompanyName, randEmail, randFirstName, randFloat, randFullName, randHexaDecimal,
|
|
8
|
-
import { idEmoji, idHue } from "@dxos/util";
|
|
7
|
+
import { rand, randChanceBoolean, randCompanyName, randEmail, randFirstName, randFloat, randFullName, randHexaDecimal, randNumber as randNumber2, randParagraph, randProductName, randRecentDate, randSentence, randUrl, randUuid, randWord, seed } from "@ngneat/falso";
|
|
9
8
|
|
|
10
9
|
// packages/common/random/src/data.ts
|
|
11
10
|
var airports = [
|
|
@@ -394,56 +393,7 @@ var airports = [
|
|
|
394
393
|
]
|
|
395
394
|
}
|
|
396
395
|
];
|
|
397
|
-
var
|
|
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
|
-
];
|
|
396
|
+
var randAirport = () => airports[Math.floor(Math.random() * airports.length)];
|
|
447
397
|
|
|
448
398
|
// packages/common/random/src/util.ts
|
|
449
399
|
import { randNumber } from "@ngneat/falso";
|
|
@@ -487,8 +437,8 @@ var faker = {
|
|
|
487
437
|
arrayElement: (a) => rand(a),
|
|
488
438
|
multiple: (f, { count }) => multiple(f, typeof count === "number" ? count : getCount(count)),
|
|
489
439
|
uniqueArray: (f, n) => uniqueArray(f, n),
|
|
490
|
-
randomSubset: (array
|
|
491
|
-
const length =
|
|
440
|
+
randomSubset: (array) => {
|
|
441
|
+
const length = Math.floor(Math.random() * (array.length + 1));
|
|
492
442
|
if (length === 0) {
|
|
493
443
|
return [];
|
|
494
444
|
}
|
|
@@ -510,9 +460,6 @@ var faker = {
|
|
|
510
460
|
date: {
|
|
511
461
|
recent: () => randRecentDate()
|
|
512
462
|
},
|
|
513
|
-
image: {
|
|
514
|
-
url: () => randImg()
|
|
515
|
-
},
|
|
516
463
|
//
|
|
517
464
|
// Text
|
|
518
465
|
//
|
|
@@ -570,15 +517,10 @@ var faker = {
|
|
|
570
517
|
productName: () => randProductName()
|
|
571
518
|
},
|
|
572
519
|
geo: {
|
|
573
|
-
airport: () =>
|
|
574
|
-
location: () =>
|
|
575
|
-
},
|
|
576
|
-
email: {}
|
|
577
|
-
properties: {
|
|
578
|
-
emoji: () => rand(idEmoji),
|
|
579
|
-
hue: () => rand(idHue),
|
|
580
|
-
icon: () => rand(icons)
|
|
581
|
-
}
|
|
520
|
+
airport: () => randAirport(),
|
|
521
|
+
location: () => randAirport().location
|
|
522
|
+
},
|
|
523
|
+
email: {}
|
|
582
524
|
};
|
|
583
525
|
export {
|
|
584
526
|
faker
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/index.ts", "../../../src/faker.ts", "../../../src/data.ts", "../../../src/util.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nexport * from '@ngneat/falso';\n\nexport * from './faker';\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
|
|
5
|
-
"mappings": ";;;AAIA,cAAc;;;ACAd,SACEA,MACAC,mBACAC,iBACAC,WACAC,eACAC,WACAC,cACAC,iBACAC,
|
|
6
|
-
"names": ["rand", "randChanceBoolean", "randCompanyName", "randEmail", "randFirstName", "randFloat", "randFullName", "randHexaDecimal", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nexport * from '@ngneat/falso';\n\nexport * from './faker';\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 randNumber,\n randParagraph,\n randProductName,\n randRecentDate,\n randSentence,\n randUrl,\n randUuid,\n randWord,\n seed,\n} from '@ngneat/falso';\n\nimport { randAirport } from './data';\nimport { type Range, getCount, multiple, toRange, uniqueArray } from './util';\n\n// Fake faker.\nexport const faker = {\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[]) => {\n const length = Math.floor(Math.random() * (array.length + 1));\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 },\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: () => randAirport(),\n location: () => randAirport().location,\n },\n email: {},\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nconst 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 randAirport = () => airports[Math.floor(Math.random() * airports.length)];\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,cAAAA,aACAC,eACAC,iBACAC,gBACAC,cACAC,SACAC,UACAC,UACAC,YACK;;;AClBP,IAAMC,WAAW;EACf;IAAEC,MAAM;IAAWC,MAAM;IAAOC,UAAU;MAAC;MAAU;;EAAS;EAC9D;IAAEF,MAAM;IAASC,MAAM;IAAOC,UAAU;MAAC;M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ean", "randCompanyName", "randEmail", "randFirstName", "randFloat", "randFullName", "randHexaDecimal", "randNumber", "randParagraph", "randProductName", "randRecentDate", "randSentence", "randUrl", "randUuid", "randWord", "seed", "airports", "name", "code", "location", "randAirport", "Math", "floor", "random", "length", "randNumber", "toRange", "range", "min", "max", "getCount", "randNumber", "multiple", "fn", "n", "Array", "from", "length", "map", "_", "i", "uniqueArray", "values", "isArray", "results", "selection", "Set", "push", "splice", "Math", "floor", "random", "size", "add", "faker", "seed", "value", "String", "helpers", "arrayElement", "a", "rand", "multiple", "f", "count", "getCount", "uniqueArray", "n", "randomSubset", "array", "length", "Math", "floor", "random", "number", "float", "range", "randFloat", "toRange", "undefined", "int", "randNumber", "datatype", "boolean", "p", "randChanceBoolean", "chanceTrue", "probability", "date", "recent", "randRecentDate", "lorem", "word", "randWord", "words", "join", "sentence", "text", "charAt", "toUpperCase", "slice", "randSentence", "sentences", "paragraph", "randParagraph", "paragraphs", "string", "hexadecimal", "l", "randHexaDecimal", "uuid", "randUuid", "internet", "email", "randEmail", "url", "randUrl", "person", "firstName", "randFirstName", "fullName", "randFullName", "company", "name", "randCompanyName", "commerce", "productName", "randProductName", "geo", "airport", "randAirport", "location"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/common/random/src/data.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/common/random/src/data.ts":{"bytes":15884,"imports":[],"format":"esm"},"packages/common/random/src/util.ts":{"bytes":4274,"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true}],"format":"esm"},"packages/common/random/src/faker.ts":{"bytes":10934,"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"packages/common/random/src/data.ts","kind":"import-statement","original":"./data"},{"path":"packages/common/random/src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/common/random/src/index.ts":{"bytes":590,"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"packages/common/random/src/faker.ts","kind":"import-statement","original":"./faker"}],"format":"esm"}},"outputs":{"packages/common/random/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14601},"packages/common/random/dist/lib/browser/index.mjs":{"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"@ngneat/falso","kind":"import-statement","external":true}],"exports":["faker"],"entryPoint":"packages/common/random/src/index.ts","inputs":{"packages/common/random/src/index.ts":{"bytesInOutput":31},"packages/common/random/src/faker.ts":{"bytesInOutput":2315},"packages/common/random/src/data.ts":{"bytesInOutput":4814},"packages/common/random/src/util.ts":{"bytesInOutput":827}},"bytes":8273}}}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -24,7 +24,6 @@ __export(node_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(node_exports);
|
|
25
25
|
__reExport(node_exports, require("@ngneat/falso"), module.exports);
|
|
26
26
|
var import_falso = require("@ngneat/falso");
|
|
27
|
-
var import_util = require("@dxos/util");
|
|
28
27
|
var import_falso2 = require("@ngneat/falso");
|
|
29
28
|
var airports = [
|
|
30
29
|
{
|
|
@@ -412,56 +411,7 @@ var airports = [
|
|
|
412
411
|
]
|
|
413
412
|
}
|
|
414
413
|
];
|
|
415
|
-
var
|
|
416
|
-
"ph--air-traffic-control--regular",
|
|
417
|
-
"ph--asterisk--regular",
|
|
418
|
-
"ph--atom--regular",
|
|
419
|
-
"ph--basketball--regular",
|
|
420
|
-
"ph--butterfly--regular",
|
|
421
|
-
"ph--cactus--regular",
|
|
422
|
-
"ph--cake--regular",
|
|
423
|
-
"ph--calendar-dots--regular",
|
|
424
|
-
"ph--campfire--regular",
|
|
425
|
-
"ph--command--regular",
|
|
426
|
-
"ph--confetti--regular",
|
|
427
|
-
"ph--detective--regular",
|
|
428
|
-
"ph--disco-ball--regular",
|
|
429
|
-
"ph--dna--regular",
|
|
430
|
-
"ph--factory--regular",
|
|
431
|
-
"ph--flag-banner-fold--regular",
|
|
432
|
-
"ph--flask--regular",
|
|
433
|
-
"ph--flower-lotus--regular",
|
|
434
|
-
"ph--flying-saucer--regular",
|
|
435
|
-
"ph--game-controller--regular",
|
|
436
|
-
"ph--gavel--regular",
|
|
437
|
-
"ph--gift--regular",
|
|
438
|
-
"ph--guitar--regular",
|
|
439
|
-
"ph--hamburger--regular",
|
|
440
|
-
"ph--handshake--regular",
|
|
441
|
-
"ph--heart--regular",
|
|
442
|
-
"ph--lightbulb--regular",
|
|
443
|
-
"ph--lock--regular",
|
|
444
|
-
"ph--martini--regular",
|
|
445
|
-
"ph--medal-military--regular",
|
|
446
|
-
"ph--moped-front--regular",
|
|
447
|
-
"ph--office-chair--regular",
|
|
448
|
-
"ph--paint-brush-household--regular",
|
|
449
|
-
"ph--peace--regular",
|
|
450
|
-
"ph--person-simple-hike--regular",
|
|
451
|
-
"ph--piggy-bank--regular",
|
|
452
|
-
"ph--potted-plant--regular",
|
|
453
|
-
"ph--radioactive--regular",
|
|
454
|
-
"ph--rocket-launch--regular",
|
|
455
|
-
"ph--shield-star--regular",
|
|
456
|
-
"ph--shopping-cart--regular",
|
|
457
|
-
"ph--stethoscope--regular",
|
|
458
|
-
"ph--student--regular",
|
|
459
|
-
"ph--sun--regular",
|
|
460
|
-
"ph--tote--regular",
|
|
461
|
-
"ph--tree--regular",
|
|
462
|
-
"ph--users-three--regular",
|
|
463
|
-
"ph--yin-yang--regular"
|
|
464
|
-
];
|
|
414
|
+
var randAirport = () => airports[Math.floor(Math.random() * airports.length)];
|
|
465
415
|
var toRange = (range, min = 0) => typeof range === "number" ? {
|
|
466
416
|
min,
|
|
467
417
|
max: range
|
|
@@ -500,8 +450,8 @@ var faker = {
|
|
|
500
450
|
arrayElement: (a) => (0, import_falso.rand)(a),
|
|
501
451
|
multiple: (f, { count }) => multiple(f, typeof count === "number" ? count : getCount(count)),
|
|
502
452
|
uniqueArray: (f, n) => uniqueArray(f, n),
|
|
503
|
-
randomSubset: (array
|
|
504
|
-
const length =
|
|
453
|
+
randomSubset: (array) => {
|
|
454
|
+
const length = Math.floor(Math.random() * (array.length + 1));
|
|
505
455
|
if (length === 0) {
|
|
506
456
|
return [];
|
|
507
457
|
}
|
|
@@ -523,9 +473,6 @@ var faker = {
|
|
|
523
473
|
date: {
|
|
524
474
|
recent: () => (0, import_falso.randRecentDate)()
|
|
525
475
|
},
|
|
526
|
-
image: {
|
|
527
|
-
url: () => (0, import_falso.randImg)()
|
|
528
|
-
},
|
|
529
476
|
//
|
|
530
477
|
// Text
|
|
531
478
|
//
|
|
@@ -583,15 +530,10 @@ var faker = {
|
|
|
583
530
|
productName: () => (0, import_falso.randProductName)()
|
|
584
531
|
},
|
|
585
532
|
geo: {
|
|
586
|
-
airport: () => (
|
|
587
|
-
location: () => (
|
|
588
|
-
},
|
|
589
|
-
email: {}
|
|
590
|
-
properties: {
|
|
591
|
-
emoji: () => (0, import_falso.rand)(import_util.idEmoji),
|
|
592
|
-
hue: () => (0, import_falso.rand)(import_util.idHue),
|
|
593
|
-
icon: () => (0, import_falso.rand)(icons)
|
|
594
|
-
}
|
|
533
|
+
airport: () => randAirport(),
|
|
534
|
+
location: () => randAirport().location
|
|
535
|
+
},
|
|
536
|
+
email: {}
|
|
595
537
|
};
|
|
596
538
|
// Annotate the CommonJS export names for ESM import in node:
|
|
597
539
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/index.ts", "../../../src/faker.ts", "../../../src/data.ts", "../../../src/util.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nexport * from '@ngneat/falso';\n\nexport * from './faker';\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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAAc;ACAd,
|
|
6
|
-
"names": ["import_falso", "airports", "name", "code", "location", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nexport * from '@ngneat/falso';\n\nexport * from './faker';\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 randNumber,\n randParagraph,\n randProductName,\n randRecentDate,\n randSentence,\n randUrl,\n randUuid,\n randWord,\n seed,\n} from '@ngneat/falso';\n\nimport { randAirport } from './data';\nimport { type Range, getCount, multiple, toRange, uniqueArray } from './util';\n\n// Fake faker.\nexport const faker = {\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[]) => {\n const length = Math.floor(Math.random() * (array.length + 1));\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 },\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: () => randAirport(),\n location: () => randAirport().location,\n },\n email: {},\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nconst 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 randAirport = () => airports[Math.floor(Math.random() * airports.length)];\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,yBAAc;ACAd,mBAkBO;AElBP,IAAAA,gBAA2B;ADA3B,IAAMC,WAAW;EACf;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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AAA;IACT;IACAC,WAAW,CAACrD,IAAoB,UAAMoD,2BAAa;MAAE7D,QAAQK,SAASI,CAAAA;IAAG,CAAA,EAAG8C,KAAK,GAAA;IACjFQ,WAAW,CAACtD,IAAoB,MAAC;AAC/B,UAAIA,GAAG;AACL,mBAAOoD,2BAAa;UAAE7D,QAAQK,SAASI,CAAAA;QAAG,CAAA,EAAG8C,KAAK,GAAA;MACpD;AAEA,iBAAOS,4BAAAA;IACT;IACAC,YAAY,CAACxD,IAAoB,UAAMuD,4BAAc;MAAEhE,QAAQK,SAASI,CAAAA;IAAG,CAAA,EAAG8C,KAAK,IAAA;EACrF;;;;EAKAW,QAAQ;IACNC,aAAa,CAACC,UAA2BC,8BAAgBD,CAAAA,EAAGb,KAAK,EAAA;IACjEe,MAAM,UAAMC,uBAAAA;EACd;;;;EAKAC,UAAU;IACRC,OAAO,UAAMC,wBAAAA;IACbC,KAAK,UAAMC,sBAAAA;EACb;EACAC,QAAQ;IACNC,WAAW,UAAMC,4BAAAA;IACjBC,UAAU,UAAMC,2BAAAA;EAClB;EACAC,SAAS;IACPzF,MAAM,UAAM0F,8BAAAA;EACd;EACAC,UAAU;IACRC,aAAa,UAAMC,8BAAAA;EACrB;EACAC,KAAK;IACHC,SAAS,MAAM5F,YAAAA;IACfD,UAAU,MAAMC,YAAAA,EAAcD;EAChC;EACA8E,OAAO,CAAC;AACV;",
|
|
6
|
+
"names": ["import_falso", "airports", "name", "code", "location", "randAirport", "Math", "floor", "random", "length", "toRange", "range", "min", "max", "getCount", "randNumber", "multiple", "fn", "n", "Array", "from", "map", "_", "i", "uniqueArray", "values", "isArray", "results", "selection", "Set", "push", "splice", "size", "add", "faker", "seed", "value", "String", "helpers", "arrayElement", "a", "rand", "f", "count", "randomSubset", "array", "number", "float", "randFloat", "undefined", "int", "datatype", "boolean", "p", "randChanceBoolean", "chanceTrue", "probability", "date", "recent", "randRecentDate", "lorem", "word", "randWord", "words", "join", "sentence", "text", "charAt", "toUpperCase", "slice", "randSentence", "sentences", "paragraph", "randParagraph", "paragraphs", "string", "hexadecimal", "l", "randHexaDecimal", "uuid", "randUuid", "internet", "email", "randEmail", "url", "randUrl", "person", "firstName", "randFirstName", "fullName", "randFullName", "company", "randCompanyName", "commerce", "productName", "randProductName", "geo", "airport"]
|
|
7
7
|
}
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/common/random/src/data.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/common/random/src/data.ts":{"bytes":15884,"imports":[],"format":"esm"},"packages/common/random/src/util.ts":{"bytes":4274,"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true}],"format":"esm"},"packages/common/random/src/faker.ts":{"bytes":10934,"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"packages/common/random/src/data.ts","kind":"import-statement","original":"./data"},{"path":"packages/common/random/src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/common/random/src/index.ts":{"bytes":590,"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"packages/common/random/src/faker.ts","kind":"import-statement","original":"./faker"}],"format":"esm"}},"outputs":{"packages/common/random/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14599},"packages/common/random/dist/lib/node/index.cjs":{"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"@ngneat/falso","kind":"import-statement","external":true}],"exports":["faker"],"entryPoint":"packages/common/random/src/index.ts","inputs":{"packages/common/random/src/index.ts":{"bytesInOutput":31},"packages/common/random/src/faker.ts":{"bytesInOutput":2315},"packages/common/random/src/data.ts":{"bytesInOutput":4814},"packages/common/random/src/util.ts":{"bytesInOutput":827}},"bytes":8239}}}
|
|
@@ -4,8 +4,7 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
4
4
|
export * from "@ngneat/falso";
|
|
5
5
|
|
|
6
6
|
// packages/common/random/src/faker.ts
|
|
7
|
-
import { rand, randChanceBoolean, randCompanyName, randEmail, randFirstName, randFloat, randFullName, randHexaDecimal,
|
|
8
|
-
import { idEmoji, idHue } from "@dxos/util";
|
|
7
|
+
import { rand, randChanceBoolean, randCompanyName, randEmail, randFirstName, randFloat, randFullName, randHexaDecimal, randNumber as randNumber2, randParagraph, randProductName, randRecentDate, randSentence, randUrl, randUuid, randWord, seed } from "@ngneat/falso";
|
|
9
8
|
|
|
10
9
|
// packages/common/random/src/data.ts
|
|
11
10
|
var airports = [
|
|
@@ -394,56 +393,7 @@ var airports = [
|
|
|
394
393
|
]
|
|
395
394
|
}
|
|
396
395
|
];
|
|
397
|
-
var
|
|
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
|
-
];
|
|
396
|
+
var randAirport = () => airports[Math.floor(Math.random() * airports.length)];
|
|
447
397
|
|
|
448
398
|
// packages/common/random/src/util.ts
|
|
449
399
|
import { randNumber } from "@ngneat/falso";
|
|
@@ -487,8 +437,8 @@ var faker = {
|
|
|
487
437
|
arrayElement: (a) => rand(a),
|
|
488
438
|
multiple: (f, { count }) => multiple(f, typeof count === "number" ? count : getCount(count)),
|
|
489
439
|
uniqueArray: (f, n) => uniqueArray(f, n),
|
|
490
|
-
randomSubset: (array
|
|
491
|
-
const length =
|
|
440
|
+
randomSubset: (array) => {
|
|
441
|
+
const length = Math.floor(Math.random() * (array.length + 1));
|
|
492
442
|
if (length === 0) {
|
|
493
443
|
return [];
|
|
494
444
|
}
|
|
@@ -510,9 +460,6 @@ var faker = {
|
|
|
510
460
|
date: {
|
|
511
461
|
recent: () => randRecentDate()
|
|
512
462
|
},
|
|
513
|
-
image: {
|
|
514
|
-
url: () => randImg()
|
|
515
|
-
},
|
|
516
463
|
//
|
|
517
464
|
// Text
|
|
518
465
|
//
|
|
@@ -570,15 +517,10 @@ var faker = {
|
|
|
570
517
|
productName: () => randProductName()
|
|
571
518
|
},
|
|
572
519
|
geo: {
|
|
573
|
-
airport: () =>
|
|
574
|
-
location: () =>
|
|
575
|
-
},
|
|
576
|
-
email: {}
|
|
577
|
-
properties: {
|
|
578
|
-
emoji: () => rand(idEmoji),
|
|
579
|
-
hue: () => rand(idHue),
|
|
580
|
-
icon: () => rand(icons)
|
|
581
|
-
}
|
|
520
|
+
airport: () => randAirport(),
|
|
521
|
+
location: () => randAirport().location
|
|
522
|
+
},
|
|
523
|
+
email: {}
|
|
582
524
|
};
|
|
583
525
|
export {
|
|
584
526
|
faker
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/index.ts", "../../../src/faker.ts", "../../../src/data.ts", "../../../src/util.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nexport * from '@ngneat/falso';\n\nexport * from './faker';\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
|
|
5
|
-
"mappings": ";;;AAIA,cAAc;;;ACAd,SACEA,MACAC,mBACAC,iBACAC,WACAC,eACAC,WACAC,cACAC,iBACAC,
|
|
6
|
-
"names": ["rand", "randChanceBoolean", "randCompanyName", "randEmail", "randFirstName", "randFloat", "randFullName", "randHexaDecimal", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nexport * from '@ngneat/falso';\n\nexport * from './faker';\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 randNumber,\n randParagraph,\n randProductName,\n randRecentDate,\n randSentence,\n randUrl,\n randUuid,\n randWord,\n seed,\n} from '@ngneat/falso';\n\nimport { randAirport } from './data';\nimport { type Range, getCount, multiple, toRange, uniqueArray } from './util';\n\n// Fake faker.\nexport const faker = {\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[]) => {\n const length = Math.floor(Math.random() * (array.length + 1));\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 },\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: () => randAirport(),\n location: () => randAirport().location,\n },\n email: {},\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nconst 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 randAirport = () => airports[Math.floor(Math.random() * airports.length)];\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,cAAAA,aACAC,eACAC,iBACAC,gBACAC,cACAC,SACAC,UACAC,UACAC,YACK;;;AClBP,IAAMC,WAAW;EACf;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;IAAEF,MAAM;IAAaC,MAAM;IAAOC,UAAU;MAAC;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AG4B,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;IACbC,KAAK,MAAMC,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,MAAMC,YAAAA;IACfC,UAAU,MAAMD,YAAAA,EAAcC;EAChC;EACAlB,OAAO,CAAC;AACV;",
|
|
6
|
+
"names": ["rand", "randChanceBoolean", "randCompanyName", "randEmail", "randFirstName", "randFloat", "randFullName", "randHexaDecimal", "randNumber", "randParagraph", "randProductName", "randRecentDate", "randSentence", "randUrl", "randUuid", "randWord", "seed", "airports", "name", "code", "location", "randAirport", "Math", "floor", "random", "length", "randNumber", "toRange", "range", "min", "max", "getCount", "randNumber", "multiple", "fn", "n", "Array", "from", "length", "map", "_", "i", "uniqueArray", "values", "isArray", "results", "selection", "Set", "push", "splice", "Math", "floor", "random", "size", "add", "faker", "seed", "value", "String", "helpers", "arrayElement", "a", "rand", "multiple", "f", "count", "getCount", "uniqueArray", "n", "randomSubset", "array", "length", "Math", "floor", "random", "number", "float", "range", "randFloat", "toRange", "undefined", "int", "randNumber", "datatype", "boolean", "p", "randChanceBoolean", "chanceTrue", "probability", "date", "recent", "randRecentDate", "lorem", "word", "randWord", "words", "join", "sentence", "text", "charAt", "toUpperCase", "slice", "randSentence", "sentences", "paragraph", "randParagraph", "paragraphs", "string", "hexadecimal", "l", "randHexaDecimal", "uuid", "randUuid", "internet", "email", "randEmail", "url", "randUrl", "person", "firstName", "randFirstName", "fullName", "randFullName", "company", "name", "randCompanyName", "commerce", "productName", "randProductName", "geo", "airport", "randAirport", "location"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/common/random/src/data.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/common/random/src/data.ts":{"bytes":15884,"imports":[],"format":"esm"},"packages/common/random/src/util.ts":{"bytes":4274,"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true}],"format":"esm"},"packages/common/random/src/faker.ts":{"bytes":10934,"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"packages/common/random/src/data.ts","kind":"import-statement","original":"./data"},{"path":"packages/common/random/src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"},"packages/common/random/src/index.ts":{"bytes":590,"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"packages/common/random/src/faker.ts","kind":"import-statement","original":"./faker"}],"format":"esm"}},"outputs":{"packages/common/random/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14601},"packages/common/random/dist/lib/node-esm/index.mjs":{"imports":[{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"@ngneat/falso","kind":"import-statement","external":true},{"path":"@ngneat/falso","kind":"import-statement","external":true}],"exports":["faker"],"entryPoint":"packages/common/random/src/index.ts","inputs":{"packages/common/random/src/index.ts":{"bytesInOutput":31},"packages/common/random/src/faker.ts":{"bytesInOutput":2315},"packages/common/random/src/data.ts":{"bytesInOutput":4814},"packages/common/random/src/util.ts":{"bytesInOutput":827}},"bytes":8332}}}
|
package/dist/types/src/data.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/data.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/data.ts"],"names":[],"mappings":"AAuDA,eAAO,MAAM,WAAW;;;;CAA8D,CAAC"}
|
|
@@ -10,10 +10,7 @@ export declare const faker: {
|
|
|
10
10
|
};
|
|
11
11
|
}) => T[];
|
|
12
12
|
uniqueArray: <T>(f: T[] | (() => T), n: number) => T[];
|
|
13
|
-
randomSubset: <T>(array: T[]
|
|
14
|
-
min: number;
|
|
15
|
-
max: number;
|
|
16
|
-
}) => T[];
|
|
13
|
+
randomSubset: <T>(array: T[]) => T[];
|
|
17
14
|
};
|
|
18
15
|
number: {
|
|
19
16
|
float: (range?: number | Range) => number;
|
|
@@ -27,9 +24,6 @@ export declare const faker: {
|
|
|
27
24
|
date: {
|
|
28
25
|
recent: () => Date;
|
|
29
26
|
};
|
|
30
|
-
image: {
|
|
31
|
-
url: () => string;
|
|
32
|
-
};
|
|
33
27
|
lorem: {
|
|
34
28
|
word: () => string;
|
|
35
29
|
words: (n?: number | Range) => string;
|
|
@@ -67,10 +61,5 @@ export declare const faker: {
|
|
|
67
61
|
location: () => number[];
|
|
68
62
|
};
|
|
69
63
|
email: {};
|
|
70
|
-
properties: {
|
|
71
|
-
emoji: () => string;
|
|
72
|
-
hue: () => "green" | "purple" | "red" | "violet" | "amber" | "lime" | "emerald" | "teal" | "cyan" | "fuchsia" | "pink" | "rose";
|
|
73
|
-
icon: () => string;
|
|
74
|
-
};
|
|
75
64
|
};
|
|
76
65
|
//# sourceMappingURL=faker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faker.d.ts","sourceRoot":"","sources":["../../../src/faker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"faker.d.ts","sourceRoot":"","sources":["../../../src/faker.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,KAAK,KAAK,EAA4C,MAAM,QAAQ,CAAC;AAG9E,eAAO,MAAM,KAAK;kBAIF,MAAM;;uBAEH,CAAC,KAAK,CAAC,EAAE;mBACb,CAAC,KAAK,MAAM,CAAC,aAAa;YAAE,KAAK,EAAE,MAAM,GAAG;gBAAE,GAAG,EAAE,MAAM,CAAC;gBAAC,GAAG,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE;sBAEvE,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,MAAM;uBAC/B,CAAC,SAAS,CAAC,EAAE;;;wBAaZ,MAAM,GAAG,KAAK;sBAChB,MAAM,GAAG,KAAK;;;sBAGd;YAAE,WAAW,EAAE,MAAM,CAAA;SAAE;;;;;;;oBAW1B,MAAM,GAAG,KAAK;uBACX,MAAM,GAAG,KAAK;wBAQb,MAAM,GAAG,KAAK;wBACd,MAAM,GAAG,KAAK;yBAOb,MAAM,GAAG,KAAK;;;0BAOZ;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,KAAK,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,KAAK,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,eAAO,MAAM,OAAO,UAAW,MAAM,GAAG,KAAK,wBAAuE,CAAC;AAErH,eAAO,MAAM,QAAQ,WAAY,MAAM,GAAG,KAAK,WAA4D,CAAC;AAE5G,eAAO,MAAM,QAAQ,GAAI,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,KAAK,CAAC,KAAK,MAAM,KAAG,CAAC,EAE9D,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,MAAM,KAAG,CAAC,EAoBpE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"5.
|
|
1
|
+
{"version":"5.7.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/random",
|
|
3
|
-
"version": "0.8.2-
|
|
3
|
+
"version": "0.8.2-staging.7ac8446",
|
|
4
4
|
"description": "Random data generator.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@ngneat/falso": "^7.1.1",
|
|
31
|
-
"@dxos/node-std": "0.8.2-
|
|
32
|
-
"@dxos/util": "0.8.2-main.fbd8ed0"
|
|
31
|
+
"@dxos/node-std": "0.8.2-staging.7ac8446"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {},
|
|
35
34
|
"publishConfig": {
|
package/src/data.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const airports = [
|
|
6
6
|
{ name: 'Atlanta', code: 'ATL', location: [-84.4277, 33.6407] },
|
|
7
7
|
{ name: 'Dubai', code: 'DXB', location: [55.3644, 25.2532] },
|
|
8
8
|
{ name: 'Dallas', code: 'DFW', location: [-97.0403, 32.8998] },
|
|
@@ -53,53 +53,4 @@ export const airports = [
|
|
|
53
53
|
{ name: 'Dubai', code: 'DXB', location: [55.3644, 25.2532] },
|
|
54
54
|
];
|
|
55
55
|
|
|
56
|
-
export const
|
|
57
|
-
'ph--air-traffic-control--regular',
|
|
58
|
-
'ph--asterisk--regular',
|
|
59
|
-
'ph--atom--regular',
|
|
60
|
-
'ph--basketball--regular',
|
|
61
|
-
'ph--butterfly--regular',
|
|
62
|
-
'ph--cactus--regular',
|
|
63
|
-
'ph--cake--regular',
|
|
64
|
-
'ph--calendar-dots--regular',
|
|
65
|
-
'ph--campfire--regular',
|
|
66
|
-
'ph--command--regular',
|
|
67
|
-
'ph--confetti--regular',
|
|
68
|
-
'ph--detective--regular',
|
|
69
|
-
'ph--disco-ball--regular',
|
|
70
|
-
'ph--dna--regular',
|
|
71
|
-
'ph--factory--regular',
|
|
72
|
-
'ph--flag-banner-fold--regular',
|
|
73
|
-
'ph--flask--regular',
|
|
74
|
-
'ph--flower-lotus--regular',
|
|
75
|
-
'ph--flying-saucer--regular',
|
|
76
|
-
'ph--game-controller--regular',
|
|
77
|
-
'ph--gavel--regular',
|
|
78
|
-
'ph--gift--regular',
|
|
79
|
-
'ph--guitar--regular',
|
|
80
|
-
'ph--hamburger--regular',
|
|
81
|
-
'ph--handshake--regular',
|
|
82
|
-
'ph--heart--regular',
|
|
83
|
-
'ph--lightbulb--regular',
|
|
84
|
-
'ph--lock--regular',
|
|
85
|
-
'ph--martini--regular',
|
|
86
|
-
'ph--medal-military--regular',
|
|
87
|
-
'ph--moped-front--regular',
|
|
88
|
-
'ph--office-chair--regular',
|
|
89
|
-
'ph--paint-brush-household--regular',
|
|
90
|
-
'ph--peace--regular',
|
|
91
|
-
'ph--person-simple-hike--regular',
|
|
92
|
-
'ph--piggy-bank--regular',
|
|
93
|
-
'ph--potted-plant--regular',
|
|
94
|
-
'ph--radioactive--regular',
|
|
95
|
-
'ph--rocket-launch--regular',
|
|
96
|
-
'ph--shield-star--regular',
|
|
97
|
-
'ph--shopping-cart--regular',
|
|
98
|
-
'ph--stethoscope--regular',
|
|
99
|
-
'ph--student--regular',
|
|
100
|
-
'ph--sun--regular',
|
|
101
|
-
'ph--tote--regular',
|
|
102
|
-
'ph--tree--regular',
|
|
103
|
-
'ph--users-three--regular',
|
|
104
|
-
'ph--yin-yang--regular',
|
|
105
|
-
];
|
|
56
|
+
export const randAirport = () => airports[Math.floor(Math.random() * airports.length)];
|
package/src/faker.ts
CHANGED
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
randFloat,
|
|
12
12
|
randFullName,
|
|
13
13
|
randHexaDecimal,
|
|
14
|
-
randImg,
|
|
15
14
|
randNumber,
|
|
16
15
|
randParagraph,
|
|
17
16
|
randProductName,
|
|
@@ -23,9 +22,7 @@ import {
|
|
|
23
22
|
seed,
|
|
24
23
|
} from '@ngneat/falso';
|
|
25
24
|
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
import { airports, icons } from './data';
|
|
25
|
+
import { randAirport } from './data';
|
|
29
26
|
import { type Range, getCount, multiple, toRange, uniqueArray } from './util';
|
|
30
27
|
|
|
31
28
|
// Fake faker.
|
|
@@ -39,12 +36,8 @@ export const faker = {
|
|
|
39
36
|
multiple: <T>(f: () => T, { count }: { count: number | { min: number; max: number } }) =>
|
|
40
37
|
multiple(f, typeof count === 'number' ? count : getCount(count)),
|
|
41
38
|
uniqueArray: <T>(f: T[] | (() => T), n: number) => uniqueArray(f, n),
|
|
42
|
-
randomSubset: <T>(array: T[]
|
|
43
|
-
const length =
|
|
44
|
-
count === undefined
|
|
45
|
-
? Math.floor(Math.random() * (array.length + 1))
|
|
46
|
-
: Math.min(typeof count === 'number' ? count : getCount(count), array.length);
|
|
47
|
-
|
|
39
|
+
randomSubset: <T>(array: T[]) => {
|
|
40
|
+
const length = Math.floor(Math.random() * (array.length + 1));
|
|
48
41
|
if (length === 0) {
|
|
49
42
|
return [];
|
|
50
43
|
}
|
|
@@ -65,9 +58,6 @@ export const faker = {
|
|
|
65
58
|
date: {
|
|
66
59
|
recent: () => randRecentDate(),
|
|
67
60
|
},
|
|
68
|
-
image: {
|
|
69
|
-
url: () => randImg(),
|
|
70
|
-
},
|
|
71
61
|
|
|
72
62
|
//
|
|
73
63
|
// Text
|
|
@@ -120,13 +110,8 @@ export const faker = {
|
|
|
120
110
|
productName: () => randProductName(),
|
|
121
111
|
},
|
|
122
112
|
geo: {
|
|
123
|
-
airport: () =>
|
|
124
|
-
location: () =>
|
|
113
|
+
airport: () => randAirport(),
|
|
114
|
+
location: () => randAirport().location,
|
|
125
115
|
},
|
|
126
116
|
email: {},
|
|
127
|
-
properties: {
|
|
128
|
-
emoji: () => rand(idEmoji),
|
|
129
|
-
hue: () => rand(idHue),
|
|
130
|
-
icon: () => rand(icons),
|
|
131
|
-
},
|
|
132
117
|
};
|