@elfedali/moroccan-data 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,144 @@
1
+ # @elfedali/moroccan-data
2
+
3
+ Generate realistic Moroccan test data for developers.
4
+
5
+ This is a small, Faker-like Moroccan data provider focused on practicality: names, locations, phone numbers, IDs, and basic internet/company fields.
6
+
7
+ ## Features
8
+
9
+ - Deterministic output with seeds (great for tests)
10
+ - ESM + CommonJS builds
11
+ - TypeScript types included
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm i @elfedali/moroccan-data
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ### Quick start (ESM)
22
+
23
+ ```ts
24
+ import { morocco, createMoroccanFaker } from '@elfedali/moroccan-data';
25
+
26
+ console.log(morocco.person.fullName());
27
+ console.log(morocco.location.address());
28
+ console.log(morocco.phone.internationalMobile({ formatted: true }));
29
+
30
+ const seeded = createMoroccanFaker({ seed: 123 });
31
+ console.log(seeded.id.cin());
32
+ ```
33
+
34
+ ### CommonJS
35
+
36
+ ```js
37
+ const { morocco } = require('@elfedali/moroccan-data');
38
+ console.log(morocco.person.fullName());
39
+ ```
40
+
41
+ ## Seeding (deterministic data)
42
+
43
+ ```ts
44
+ import { createMoroccanFaker } from '@elfedali/moroccan-data';
45
+
46
+ const f1 = createMoroccanFaker({ seed: 42 });
47
+ const f2 = createMoroccanFaker({ seed: 42 });
48
+
49
+ // Same outputs across runs
50
+ console.log(f1.person.fullName());
51
+ console.log(f2.person.fullName());
52
+ ```
53
+
54
+ ## API
55
+
56
+ The default singleton is `morocco`.
57
+
58
+ You can also create your own instance: `createMoroccanFaker({ seed? })`.
59
+
60
+ ### person
61
+
62
+ - `morocco.person.firstName(gender?)`
63
+ - `morocco.person.lastName()`
64
+ - `morocco.person.fullName({ gender? })`
65
+ - `morocco.person.jobTitle()`
66
+
67
+ ### location
68
+
69
+ - `morocco.location.city()` / `region()` / `postalCode()` / `streetAddress()`
70
+ - `morocco.location.latitude()` / `longitude()` / `coordinates()`
71
+ - `morocco.location.address()`
72
+
73
+ `address()` returns:
74
+
75
+ ```ts
76
+ {
77
+ street: string;
78
+ city: string;
79
+ region: string;
80
+ postalCode: string;
81
+ latitude: number;
82
+ longitude: number;
83
+ country: 'Morocco';
84
+ countryCode: 'MA';
85
+ }
86
+ ```
87
+
88
+ ### phone
89
+
90
+ - `morocco.phone.mobile({ formatted? })` / `internationalMobile({ formatted? })`
91
+
92
+ Examples:
93
+
94
+ - `mobile()` → `06XXXXXXXX` or `07XXXXXXXX`
95
+ - `mobile({ formatted: true })` → `06 12 34 56 78`
96
+ - `internationalMobile()` → `+2126XXXXXXXX`
97
+
98
+ ### internet
99
+
100
+ - `morocco.internet.username()` / `email()`
101
+
102
+ ### id
103
+
104
+ - `morocco.id.cin()` / `ice()`
105
+
106
+ ### company
107
+
108
+ - `morocco.company.name()`
109
+
110
+ ### date
111
+
112
+ - `morocco.date.between(from, to)`
113
+ - `morocco.date.isoDate({ from?, to? })` → `YYYY-MM-DD`
114
+
115
+ ### time
116
+
117
+ - `morocco.time.hhmm()` → `HH:mm`
118
+ - `morocco.time.hhmmss()` → `HH:mm:ss`
119
+
120
+ ### text (real sentences)
121
+
122
+ - `morocco.text.sentence()`
123
+ - `morocco.text.paragraph({ sentences? })`
124
+ - `morocco.text.text({ sentences? })`
125
+
126
+ ### number
127
+
128
+ - `morocco.number.int({ min?, max? })`
129
+ - `morocco.number.float({ min?, max?, precision? })`
130
+
131
+ ## Notes
132
+
133
+ - This library generates *fake* data that looks plausible; it does not guarantee official validation rules for every identifier.
134
+
135
+ ## Dev
136
+
137
+ - Build: `npm run build`
138
+ - Test: `npm test`
139
+ - Watch: `npm run dev` / `npm run test:watch`
140
+
141
+ ## Help the developer
142
+
143
+ - PayPal: a.elfedali@gmail.com
144
+ - GitHub: https://github.com/elfedali