@20syldev/api 4.8.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +93 -55
  2. package/dist/config/versions.js +16 -0
  3. package/dist/config/versions.js.map +1 -1
  4. package/dist/constants.js +5 -0
  5. package/dist/constants.js.map +1 -1
  6. package/dist/modules/v5/chart.js +379 -0
  7. package/dist/modules/v5/chart.js.map +1 -0
  8. package/dist/modules/v5/evaluate.js +281 -0
  9. package/dist/modules/v5/evaluate.js.map +1 -0
  10. package/dist/modules/v5/matrix.js +238 -0
  11. package/dist/modules/v5/matrix.js.map +1 -0
  12. package/dist/modules/v5.js +5 -0
  13. package/dist/modules/v5.js.map +1 -0
  14. package/dist/routes/get.js +191 -162
  15. package/dist/routes/get.js.map +1 -1
  16. package/dist/routes/post.js +69 -0
  17. package/dist/routes/post.js.map +1 -1
  18. package/package.json +4 -2
  19. package/recap.md +98 -0
  20. package/.github/FUNDING.yml +0 -1
  21. package/.prettierrc +0 -7
  22. package/eslint.config.js +0 -24
  23. package/robots.txt +0 -74
  24. package/src/app.ts +0 -53
  25. package/src/config/env.ts +0 -87
  26. package/src/config/plans.ts +0 -61
  27. package/src/config/versions.ts +0 -121
  28. package/src/constants.ts +0 -61
  29. package/src/favicon.ico +0 -0
  30. package/src/middleware/cors.ts +0 -23
  31. package/src/middleware/error.ts +0 -16
  32. package/src/middleware/json.ts +0 -9
  33. package/src/middleware/logger.ts +0 -32
  34. package/src/middleware/ratelimit.ts +0 -89
  35. package/src/middleware/version.ts +0 -40
  36. package/src/modules/v3/algorithms.js +0 -218
  37. package/src/modules/v3/captcha.js +0 -60
  38. package/src/modules/v3/chat.js +0 -111
  39. package/src/modules/v3/color.js +0 -60
  40. package/src/modules/v3/convert.js +0 -39
  41. package/src/modules/v3/domain.js +0 -86
  42. package/src/modules/v3/hash.js +0 -16
  43. package/src/modules/v3/hyperplanning.js +0 -56
  44. package/src/modules/v3/levenshtein.js +0 -46
  45. package/src/modules/v3/personal.js +0 -139
  46. package/src/modules/v3/qrcode.js +0 -20
  47. package/src/modules/v3/tic_tac_toe.js +0 -242
  48. package/src/modules/v3/time.js +0 -98
  49. package/src/modules/v3/token.js +0 -54
  50. package/src/modules/v3/username.js +0 -94
  51. package/src/modules/v3/utils.js +0 -77
  52. package/src/modules/v3.js +0 -15
  53. package/src/modules/v4/address.ts +0 -412
  54. package/src/modules/v4/agent.ts +0 -104
  55. package/src/modules/v4/algorithms.ts +0 -276
  56. package/src/modules/v4/captcha.ts +0 -114
  57. package/src/modules/v4/chat.ts +0 -130
  58. package/src/modules/v4/color.ts +0 -75
  59. package/src/modules/v4/convert.ts +0 -127
  60. package/src/modules/v4/cron.ts +0 -221
  61. package/src/modules/v4/dice.ts +0 -46
  62. package/src/modules/v4/domain.ts +0 -86
  63. package/src/modules/v4/encode.ts +0 -241
  64. package/src/modules/v4/geo.ts +0 -64
  65. package/src/modules/v4/hash.ts +0 -32
  66. package/src/modules/v4/hyperplanning.ts +0 -93
  67. package/src/modules/v4/ip.ts +0 -134
  68. package/src/modules/v4/levenshtein.ts +0 -46
  69. package/src/modules/v4/palette.ts +0 -71
  70. package/src/modules/v4/password.ts +0 -379
  71. package/src/modules/v4/personal.ts +0 -140
  72. package/src/modules/v4/placeholder.ts +0 -197
  73. package/src/modules/v4/qrcode.ts +0 -121
  74. package/src/modules/v4/regex.ts +0 -67
  75. package/src/modules/v4/statistics.ts +0 -62
  76. package/src/modules/v4/text.ts +0 -330
  77. package/src/modules/v4/tic_tac_toe.ts +0 -264
  78. package/src/modules/v4/time.ts +0 -149
  79. package/src/modules/v4/token.ts +0 -53
  80. package/src/modules/v4/username.ts +0 -94
  81. package/src/modules/v4/validate.ts +0 -76
  82. package/src/modules/v4.ts +0 -29
  83. package/src/routes/delete.ts +0 -72
  84. package/src/routes/get.ts +0 -856
  85. package/src/routes/index.ts +0 -59
  86. package/src/routes/patch.ts +0 -45
  87. package/src/routes/post.ts +0 -209
  88. package/src/storage/index.ts +0 -16
  89. package/src/types/express.d.ts +0 -17
  90. package/src/types/storage.ts +0 -48
  91. package/src/utils/colors.ts +0 -91
  92. package/src/utils/helpers.ts +0 -90
  93. package/src/utils/response.ts +0 -28
  94. package/tests/integration/api.test.ts +0 -772
  95. package/tests/tsconfig.json +0 -3
  96. package/tests/unit/address.test.ts +0 -84
  97. package/tests/unit/agent.test.ts +0 -113
  98. package/tests/unit/algorithms.test.ts +0 -121
  99. package/tests/unit/captcha.test.ts +0 -62
  100. package/tests/unit/chat.test.ts +0 -54
  101. package/tests/unit/color.test.ts +0 -54
  102. package/tests/unit/convert.test.ts +0 -68
  103. package/tests/unit/cron.test.ts +0 -110
  104. package/tests/unit/dice.test.ts +0 -58
  105. package/tests/unit/domain.test.ts +0 -48
  106. package/tests/unit/encode.test.ts +0 -109
  107. package/tests/unit/geo.test.ts +0 -46
  108. package/tests/unit/hash.test.ts +0 -45
  109. package/tests/unit/hyperplanning.test.ts +0 -97
  110. package/tests/unit/ip.test.ts +0 -140
  111. package/tests/unit/levenshtein.test.ts +0 -35
  112. package/tests/unit/palette.test.ts +0 -54
  113. package/tests/unit/password.test.ts +0 -86
  114. package/tests/unit/personal.test.ts +0 -66
  115. package/tests/unit/placeholder.test.ts +0 -58
  116. package/tests/unit/qrcode.test.ts +0 -83
  117. package/tests/unit/regex.test.ts +0 -95
  118. package/tests/unit/statistics.test.ts +0 -58
  119. package/tests/unit/text.test.ts +0 -108
  120. package/tests/unit/tic_tac_toe.test.ts +0 -56
  121. package/tests/unit/time.test.ts +0 -115
  122. package/tests/unit/token.test.ts +0 -62
  123. package/tests/unit/username.test.ts +0 -35
  124. package/tests/unit/validate.test.ts +0 -72
  125. package/tsconfig.json +0 -17
  126. package/tsconfig.test.json +0 -9
@@ -1,60 +0,0 @@
1
- /**
2
- * Generate a random color in multiple formats
3
- *
4
- * @returns {Object} Color in various formats (hex, rgb, hsl, hsv, hwb, cmyk)
5
- */
6
- export default function color() {
7
- const r = Math.floor(Math.random() * 256),
8
- g = Math.floor(Math.random() * 256),
9
- b = Math.floor(Math.random() * 256);
10
-
11
- const hsl = (() => {
12
- const r1 = r / 255,
13
- g1 = g / 255,
14
- b1 = b / 255,
15
- max = Math.max(r1, g1, b1),
16
- min = Math.min(r1, g1, b1),
17
- l = (max + min) / 2;
18
- if (max === min) return [0, 0, l * 100];
19
- const d = max - min,
20
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
21
- let h = { [r1]: (g1 - b1) / d + (g1 < b1 ? 6 : 0), [g1]: (b1 - r1) / d + 2, [b1]: (r1 - g1) / d + 4 }[max];
22
- return [(h * 60) % 360, s * 100, l * 100];
23
- })();
24
-
25
- const hsv = (() => {
26
- const max = Math.max(r, g, b),
27
- min = Math.min(r, g, b),
28
- v = max / 255,
29
- s = max ? (max - min) / max : 0;
30
- let h =
31
- max === min
32
- ? 0
33
- : { [r]: (g - b) / (max - min), [g]: 2 + (b - r) / (max - min), [b]: 4 + (r - g) / (max - min) }[max];
34
- return [(h * 60) % 360, s * 100, v * 100];
35
- })();
36
-
37
- const hwb = (() => {
38
- const [h] = hsv,
39
- whiteness = Math.min(r, g, b) / 255,
40
- blackness = 1 - Math.max(r, g, b) / 255;
41
- return [h, whiteness * 100, blackness * 100];
42
- })();
43
-
44
- const cmyk = (() => {
45
- const k = 1 - Math.max(r, g, b) / 255,
46
- c = (1 - r / 255 - k) / (1 - k) || 0,
47
- m = (1 - g / 255 - k) / (1 - k) || 0,
48
- y = (1 - b / 255 - k) / (1 - k) || 0;
49
- return [c, m, y, k].map((x) => x * 100);
50
- })();
51
-
52
- return {
53
- hex: `#${[r, g, b].map((x) => x.toString(16).padStart(2, '0')).join('')}`,
54
- rgb: `rgb(${r}, ${g}, ${b})`,
55
- hsl: `hsl(${hsl[0].toFixed(1)}, ${hsl[1].toFixed(1)}%, ${hsl[2].toFixed(1)}%)`,
56
- hsv: `hsv(${hsv[0].toFixed(1)}, ${hsv[1].toFixed(1)}%, ${hsv[2].toFixed(1)}%)`,
57
- hwb: `hwb(${hwb[0].toFixed(1)}, ${hwb[1].toFixed(1)}%, ${hwb[2].toFixed(1)}%)`,
58
- cmyk: `cmyk(${cmyk.map((x) => x.toFixed(1)).join('%, ')}%)`,
59
- };
60
- }
@@ -1,39 +0,0 @@
1
- /**
2
- * Converts values between different temperature units
3
- *
4
- * @param {number|string} value - The value to convert
5
- * @param {string} from - The source unit (celsius, fahrenheit, or kelvin)
6
- * @param {string} to - The target unit (celsius, fahrenheit, or kelvin)
7
- * @returns {Object} - Object containing the conversion details
8
- * @throws {Error} - If conversion parameters are invalid
9
- */
10
- export default function convert(value, from, to) {
11
- const conversions = {
12
- celsius: {
13
- fahrenheit: (val) => (val * 9) / 5 + 32,
14
- kelvin: (val) => val + 273.15,
15
- },
16
- fahrenheit: {
17
- celsius: (val) => ((val - 32) * 5) / 9,
18
- kelvin: (val) => ((val - 32) * 5) / 9 + 273.15,
19
- },
20
- kelvin: {
21
- celsius: (val) => val - 273.15,
22
- fahrenheit: (val) => ((val - 273.15) * 9) / 5 + 32,
23
- },
24
- };
25
-
26
- const convert = conversions[from.toLowerCase()]?.[to.toLowerCase()];
27
-
28
- if (!convert) throw new Error('Invalid conversion unit');
29
- if (isNaN(value)) throw new Error('Value must be a number');
30
- if (value < -273.15) throw new Error('Value must be greater than absolute zero');
31
- if (value > 1e6) throw new Error('Value must be less than 1,000,000');
32
-
33
- return {
34
- from,
35
- to,
36
- value: parseFloat(value),
37
- result: convert(parseFloat(value)),
38
- };
39
- }
@@ -1,86 +0,0 @@
1
- import { random, genIP } from './utils.js';
2
-
3
- /**
4
- * Generate random domain information
5
- *
6
- * @returns {Object} Domain details including DNS, hosting, and SEO metrics
7
- */
8
- export default function domain() {
9
- const subdomains = [
10
- 'fr.',
11
- 'en.',
12
- 'docs.',
13
- 'api.',
14
- 'projects.',
15
- 'app.',
16
- 'web.',
17
- 'info.',
18
- 'dev.',
19
- 'shop.',
20
- 'blog.',
21
- 'support.',
22
- 'mail.',
23
- 'forum.',
24
- ];
25
- const domains = [
26
- 'example',
27
- 'site',
28
- 'test',
29
- 'demo',
30
- 'page',
31
- 'store',
32
- 'portfolio',
33
- 'platform',
34
- 'hub',
35
- 'network',
36
- 'service',
37
- 'cloud',
38
- 'solutions',
39
- 'company',
40
- ];
41
- const tlds = [
42
- '.com',
43
- '.fr',
44
- '.eu',
45
- '.dev',
46
- '.net',
47
- '.org',
48
- '.io',
49
- '.tech',
50
- '.biz',
51
- '.info',
52
- '.co',
53
- '.app',
54
- '.store',
55
- '.online',
56
- '.shop',
57
- '.tv',
58
- ];
59
-
60
- const domain = `${random(domains)}${random(tlds)}`;
61
- const fulldomain = `${random(subdomains)}${domain}`;
62
-
63
- const ips = Array.from({ length: Math.floor(Math.random() * 3) + 1 }, genIP);
64
- const dns = Array.from({ length: Math.floor(Math.random() * 5) + 1 }, genIP);
65
-
66
- return {
67
- domain,
68
- full_domain: fulldomain,
69
- ip_address: ips,
70
- ssl_certified: Math.random() > 0.5,
71
- hosting_provider: random(['AWS', 'Bluehost', 'DigitalOcean', 'GitHub', 'HostGator', 'Render', 'SiteGround']),
72
- dns_servers: dns,
73
- dns_provider: random(['AWS Route 53', 'Cloudflare', 'GoDaddy', 'Google DNS', 'Namecheap']),
74
- traffic: `${Math.floor(Math.random() * 10000)} visits/day`,
75
- seo_score: Math.floor(Math.random() * 100),
76
- page_rank: Math.floor(Math.random() * 10),
77
- country: random(['Australia', 'Canada', 'France', 'Germany', 'India', 'Japan', 'UK', 'USA']),
78
- website_type: random(['Blog', 'Community', 'Corporate', 'Educational', 'E-commerce', 'Personal', 'Portfolio']),
79
- random_name: domain.split('.')[0],
80
- random_subdomain: fulldomain.split('.')[0],
81
- random_tld: domain.split('.').pop(),
82
- backlinks_count: Math.floor(Math.random() * 1000),
83
- creation_date: new Date(Date.now() - Math.floor(Math.random() * 10000000000)).toISOString(),
84
- expiration_date: new Date(Date.now() + Math.floor(Math.random() * 10000000000)).toISOString(),
85
- };
86
- }
@@ -1,16 +0,0 @@
1
- import { getHashes, createHash } from 'crypto';
2
-
3
- /**
4
- * Generate a hash of text using the specified algorithm
5
- *
6
- * @param {string} text - The text to hash
7
- * @param {string} method - The hash algorithm to use
8
- * @returns {Object} Object containing the method and resulting hash
9
- */
10
- export default function hash(text, method) {
11
- const methods = getHashes();
12
- if (!methods.includes(method)) return { error: `Unsupported method. Use one of: ${methods.join(', ')}` };
13
-
14
- const hash = createHash(method).update(text).digest('hex');
15
- return { method, hash };
16
- }
@@ -1,56 +0,0 @@
1
- import { formatDate } from './utils.js';
2
- import ical from 'ical.js';
3
-
4
- /**
5
- * Parse an ICS calendar file and extract event information
6
- *
7
- * @param {string} url - URL to the ICS file
8
- * @param {string} [detail] - Detail level of returned information ('full', 'list', or undefined)
9
- * @returns {Promise<Array>} Array of calendar events
10
- * @throws {Error} If the ICS file is invalid or inaccessible
11
- */
12
- export default async function hyperplanning(url, detail) {
13
- const response = await fetch(url);
14
-
15
- if (!response.ok || !(response.headers.get('content-type') || '').includes('text/calendar')) {
16
- throw new Error('Invalid ICS file format.');
17
- }
18
-
19
- const events = new ical.Component(ical.parse(await response.text()))
20
- .getAllSubcomponents('vevent')
21
- .map((e) => {
22
- const evt = new ical.Event(e);
23
- const summary = (evt.summary || '').split(' ').filter((part) => part !== '-');
24
- const start = formatDate(evt.startDate.toJSDate());
25
- const end = formatDate(evt.endDate.toJSDate());
26
-
27
- if (detail === 'full') {
28
- const desc = (evt.description || '').split('\n').map((l) => l.trim());
29
- const extract = (p) => (desc.find((l) => l.startsWith(p)) || '').replace(p, '').trim();
30
-
31
- return {
32
- summary,
33
- subject: extract('Matière :'),
34
- teacher: extract('Enseignant :'),
35
- classes: extract('Promotions :')
36
- .split(', ')
37
- .map((c) => c.trim()),
38
- type: extract('Salle :') || undefined,
39
- start,
40
- end,
41
- };
42
- }
43
-
44
- if (detail === 'list') return { summary, start, end };
45
-
46
- return {
47
- summary: evt.summary || '',
48
- start,
49
- end,
50
- };
51
- })
52
- .sort((a, b) => new Date(a.start) - new Date(b.start))
53
- .filter((e) => new Date(e.end) >= new Date());
54
-
55
- return events;
56
- }
@@ -1,46 +0,0 @@
1
- /**
2
- * Calculate the Levenshtein distance between two strings.
3
- *
4
- * @param {string} str1 - The first string
5
- * @param {string} str2 - The second string
6
- * @returns {object} - Object containing the strings and their Levenshtein distance
7
- * @throws {Error} - If inputs are invalid
8
- */
9
- export default function levenshtein(str1, str2) {
10
- // Input validation
11
- if (!str1 || typeof str1 !== 'string') {
12
- throw new Error('Please provide a valid first string');
13
- }
14
-
15
- if (!str2 || typeof str2 !== 'string') {
16
- throw new Error('Please provide a valid second string');
17
- }
18
-
19
- if (str1.length > 1000) {
20
- throw new Error('First string exceeds 1000 characters');
21
- }
22
-
23
- if (str2.length > 1000) {
24
- throw new Error('Second string exceeds 1000 characters');
25
- }
26
-
27
- // Calculate Levenshtein distance
28
- const m = Array.from({ length: str1.length + 1 }, (_, i) => [i]);
29
- for (let j = 0; j <= str2.length; j++) m[0][j] = j;
30
-
31
- for (let i = 1; i <= str1.length; i++) {
32
- for (let j = 1; j <= str2.length; j++) {
33
- m[i][j] = Math.min(
34
- m[i - 1][j] + 1,
35
- m[i][j - 1] + 1,
36
- m[i - 1][j - 1] + (str1[i - 1] !== str2[j - 1] ? 1 : 0),
37
- );
38
- }
39
- }
40
-
41
- return {
42
- str1,
43
- str2,
44
- distance: m[str1.length][str2.length],
45
- };
46
- }
@@ -1,139 +0,0 @@
1
- import { random, randomNumber } from './utils.js';
2
-
3
- /**
4
- * Generate random personal information
5
- *
6
- * @returns {Object} Comprehensive personal profile with contact info, financial data, and more
7
- */
8
- export default function personal() {
9
- const people = [
10
- { name: 'John Doe', social: 'john_doe', email: 'john@example.com', country: 'US' },
11
- { name: 'Jane Martin', social: 'jane_martin', email: 'jane@example.com', country: 'FR' },
12
- { name: 'Michael Johnson', social: 'mike_johnson', email: 'michael@example.com', country: 'UK' },
13
- { name: 'Emily Davis', social: 'emily_davis', email: 'emily@example.com', country: 'ES' },
14
- { name: 'Alexis Barbos', social: 'alexis_barbos', email: 'alexis@example.com', country: 'DE' },
15
- { name: 'Sarah Williams', social: 'sarah_williams', email: 'sarah@example.com', country: 'IT' },
16
- { name: 'Daniel Brown', social: 'daniel_brown', email: 'daniel@example.com', country: 'JP' },
17
- { name: 'Sophia Wilson', social: 'sophia_wilson', email: 'sophia@example.com', country: 'BR' },
18
- { name: 'James Taylor', social: 'james_taylor', email: 'james@example.com', country: 'CA' },
19
- { name: 'Olivia Thomas', social: 'olivia_thomas', email: 'olivia@example.com', country: 'AU' },
20
- ];
21
-
22
- const countries = {
23
- US: { tel: '123-456-7890', code: '1', lang: 'English' },
24
- FR: { tel: '06 78 90 12 34', code: '33', lang: 'French' },
25
- UK: { tel: '7911 123456', code: '44', lang: 'English' },
26
- ES: { tel: '678 901 234', code: '34', lang: 'Spanish' },
27
- DE: { tel: '163 555 1584', code: '49', lang: 'German' },
28
- IT: { tel: '345 678 9012', code: '39', lang: 'Italian' },
29
- JP: { tel: '080-1234-5678', code: '81', lang: 'Japanese' },
30
- BR: { tel: '(11) 98765-4321', code: '55', lang: 'Portuguese' },
31
- CA: { tel: '416-123-4567', code: '1', lang: 'English' },
32
- AU: { tel: '0412 345 678', code: '61', lang: 'English' },
33
- };
34
-
35
- const jobs = ['Writer', 'Artist', 'Musician', 'Explorer', 'Scientist', 'Engineer', 'Athlete', 'Doctor'];
36
- const hobbies = ['Reading', 'Traveling', 'Gaming', 'Cooking', 'Fitness', 'Music', 'Photography', 'Writing'];
37
- const cities = [
38
- 'New York',
39
- 'Paris',
40
- 'London',
41
- 'Madrid',
42
- 'Berlin',
43
- 'Rome',
44
- 'Tokyo',
45
- 'Los Angeles',
46
- 'Sydney',
47
- 'São Paulo',
48
- 'Toronto',
49
- ];
50
- const streets = ['Main St', '2nd Ave', 'Broadway', 'Park Lane', 'Elm St', 'Sunset Blvd', 'Maple St', 'Highland Rd'];
51
-
52
- const card = Array.from({ length: 4 }, () => randomNumber(1000, 9999)).join(' ');
53
- const cvc = randomNumber(100, 999);
54
- const expiration = `${String(randomNumber(1, 12)).padStart(2, '0')}/${(new Date().getFullYear() + randomNumber(0, 3)).toString().slice(-2)}`;
55
-
56
- const person = random(people);
57
- const social = person.social;
58
- const country = person.country;
59
- const phone = countries[country].tel;
60
- const lang = countries[country].lang;
61
-
62
- const age = randomNumber(18, 67);
63
- const birthday = new Date(Date.now() - randomNumber(18, 67) * 365.25 * 24 * 60 * 60 * 1000).toISOString();
64
-
65
- let emergencyContacts = [];
66
- let yearIncome = randomNumber(20000, 100000);
67
- let subscriptions = [];
68
- let pets = [];
69
- let vehicles = [];
70
- let civilStatus = 'Single';
71
- let children = 0;
72
-
73
- if (age >= 21 && Math.random() > 0.7) civilStatus = 'Married';
74
-
75
- if (civilStatus === 'Married' && age >= 25) children = randomNumber(0, 3);
76
-
77
- while (emergencyContacts.length < randomNumber(1, 3)) {
78
- let emergencyContact = random(people);
79
- while (
80
- emergencyContact.email === person.email ||
81
- emergencyContacts.some((e) => e.email === emergencyContact.email)
82
- ) {
83
- emergencyContact = random(people);
84
- }
85
- const emergencyPhone = `${randomNumber(100, 999)}-${randomNumber(100, 999)}-${randomNumber(1000, 9999)}`;
86
- emergencyContacts.push({
87
- name: emergencyContact.name,
88
- relationship: random(['Spouse', 'Parent', 'Sibling', 'Friend']),
89
- phone: `+${countries[country].code} ${emergencyPhone}`,
90
- });
91
- }
92
-
93
- while (subscriptions.length < randomNumber(1, 3)) {
94
- let subscription = random(['Netflix', 'Spotify', 'Amazon Prime', 'Disney+', 'Hulu']);
95
- if (!subscriptions.includes(subscription)) subscriptions.push(subscription);
96
- }
97
-
98
- while (pets.length < randomNumber(1, 3)) {
99
- let pet = random(['Dog', 'Cat', 'Fish', 'Bird', 'None']);
100
- if (!pets.includes(pet)) pets.push(pet);
101
- }
102
-
103
- while (vehicles.length < randomNumber(1, 3)) {
104
- let vehicle = random(['Car', 'Bike', 'Motorcycle', 'Bus', 'None']);
105
- if (!vehicles.includes(vehicle)) vehicles.push(vehicle);
106
- }
107
-
108
- return {
109
- name: person.name,
110
- email: person.email,
111
- localisation: country,
112
- phone: `+${countries[country].code} ${phone}`,
113
- job: random(jobs),
114
- hobbies: random(hobbies),
115
- language: lang,
116
- card,
117
- cvc,
118
- expiration,
119
- address: `${randomNumber(1, 9999)} ${random(streets)}, ${random(cities)}`,
120
- birthday,
121
- civil_status: civilStatus,
122
- children,
123
- vehicle: vehicles,
124
- social_profiles: {
125
- twitter: `@${social}`,
126
- facebook: `facebook.com/${social}`,
127
- linkedin: `linkedin.com/in/${social}`,
128
- instagram: `instagram.com/${social}`,
129
- },
130
- year_income: `${yearIncome} USD/year`,
131
- month_income: `${(yearIncome / 12).toFixed(2)} USD/month`,
132
- education: random(['High School', "Bachelor's", "Master's", 'PhD']),
133
- work_experience: `${randomNumber(0, 20)} years`,
134
- health_status: random(['Healthy', 'Minor Issues', 'Chronic Conditions']),
135
- emergency_contacts: emergencyContacts,
136
- subscriptions,
137
- pets,
138
- };
139
- }
@@ -1,20 +0,0 @@
1
- import { toDataURL } from 'qrcode';
2
-
3
- /**
4
- * Generate a QR code for the provided URL.
5
- *
6
- * @param {string} url - The URL to encode in the QR code
7
- * @returns {Promise<string>} - Base64 encoded QR code image
8
- * @throws {Error} - If URL is invalid or QR code generation fails
9
- */
10
- export default async function qrcode(url) {
11
- // Input validation
12
- if (!url || typeof url !== 'string') throw new Error('Please provide a valid URL');
13
-
14
- try {
15
- // Generate QR code
16
- return await toDataURL(url);
17
- } catch (error) {
18
- throw new Error(`Failed to generate QR code: ${error.message}`);
19
- }
20
- }