fake-data-npm 1.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.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # fake-data-npm
2
+
3
+ > Library to generate fake profiles and related data
4
+
5
+ A tiny TypeScript/ESM utility for creating random person profiles, social
6
+ handles, emails, credit cards, etc. Designed for use in Node projects and
7
+ bundlers; ships with type declarations and JSDoc for editor autocompletion.
8
+
9
+ ---
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install fake-data-npm
15
+ # or with pnpm/yarn
16
+ ```
17
+
18
+ The package is published as an ES module. Ensure your environment supports
19
+ `import` (Node 14+ with `"type":"module"` or using a bundler).
20
+
21
+ ## Build (for contributors)
22
+
23
+ ```bash
24
+ git clone <repo>
25
+ cd FakeData-npm
26
+ npm install
27
+ npm run build # output in `dist/`
28
+ npm run clean # remove build output
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ ```ts
34
+ import { generateFakeProfile } from 'fake-data-npm';
35
+
36
+ const profile = generateFakeProfile({ countryName: 'France', birthGender: 'female' });
37
+ console.log(profile); // JSON string
38
+
39
+ // other helpers:
40
+ import {
41
+ randomItem,
42
+ generatePhoneNumber,
43
+ generateSocialHandleVariant,
44
+ ...
45
+ } from 'fake-data-npm';
46
+
47
+ console.log(generatePhoneNumber('+33')); // +33xxxxxxxxx
48
+ ```
49
+
50
+ You can also generate batches and export CSV:
51
+
52
+ ```ts
53
+ import { generateAndComposeCSV } from 'fake-data-npm';
54
+ const csv = generateAndComposeCSV(1000, 100, {});
55
+ console.log(csv.split('\n').length);
56
+ ```
57
+
58
+ ## API
59
+
60
+ | Function | Description |
61
+ |----------|-------------|
62
+ | `randomItem(arr)` | Return random element from array |
63
+ | `generatePhoneNumber(countryCode)` | Fake phone number |
64
+ | `generateSocialHandleVariant(name,surname,pseudo,media)` | Variant
65
+ | `generateRandomDigits(length)` | String of digits |
66
+ | `buildCredibleEmailAddress(first,last,country)` | Email generator |
67
+ | `generateCreditCard()` | Fake CC data |
68
+ | `getRandomUsername()` | Get from internal list |
69
+ | `generateRandomDate()` | Random adult birthdate |
70
+ | `getAge(date)` | Age from birthdate |
71
+ | `getContinent(code)` | Continent from country code |
72
+ | `generatePreferences(categories,gender)` | Ad preference map |
73
+ | `generateFakeProfile(params)` | Full profile JSON string |
74
+ | `generateFakeProfilesBatch(batchSize,params)` | Array of profiles |
75
+ | `generateAndComposeCSV(total,batch,params)` | CSV string of profiles |
76
+ | `composeCSVFile(data)` | Convert profiles to CSV |
77
+ | `writeCSVFile(fname,content)` | Write CSV to disk |
78
+
79
+ Refer to inline JSDoc and generated `.d.ts` for detailed types.
80
+
81
+ ## License
82
+
83
+ MIT