@drichdev/genata 1.0.2 → 1.0.4
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 +72 -11
- package/dist/index.d.ts +1 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -28
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -15,28 +15,53 @@ A lightweight, secure, and TypeScript-first library for generating realistic fak
|
|
|
15
15
|
## 📦 Installation
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
npm install genata
|
|
18
|
+
npm install @drichdev/genata
|
|
19
19
|
# or
|
|
20
|
-
yarn add genata
|
|
20
|
+
yarn add @drichdev/genata
|
|
21
21
|
# or
|
|
22
|
-
pnpm add genata
|
|
22
|
+
pnpm add @drichdev/genata
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
## 🎯 Quick Start
|
|
26
26
|
|
|
27
|
-
###
|
|
27
|
+
### CommonJS (Node.js)
|
|
28
28
|
|
|
29
29
|
```javascript
|
|
30
|
-
|
|
30
|
+
const genata = require('@drichdev/genata');
|
|
31
31
|
|
|
32
|
-
// Generate single values
|
|
33
32
|
const email = genata.email();
|
|
34
33
|
const firstName = genata.firstName();
|
|
35
34
|
const phone = genata.phone();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### ES Modules (Node.js with "type": "module")
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
import genata from '@drichdev/genata';
|
|
36
41
|
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const
|
|
42
|
+
const email = genata.email();
|
|
43
|
+
const firstName = genata.firstName();
|
|
44
|
+
const phone = genata.phone();
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### TypeScript / Next.js
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import genata from '@drichdev/genata';
|
|
51
|
+
|
|
52
|
+
export default function Home() {
|
|
53
|
+
const email = genata.email();
|
|
54
|
+
const firstName = genata.firstName();
|
|
55
|
+
const phone = genata.phone();
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div>
|
|
59
|
+
<p>Email: {email}</p>
|
|
60
|
+
<p>Name: {firstName}</p>
|
|
61
|
+
<p>Phone: {phone}</p>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
40
65
|
```
|
|
41
66
|
|
|
42
67
|
### Using Generators by Category
|
|
@@ -146,8 +171,8 @@ Location: address, city, country, zip
|
|
|
146
171
|
Internet: url, ipv4, ipv6, credit_card
|
|
147
172
|
Company: company, job_title
|
|
148
173
|
Date: date, datetime
|
|
149
|
-
Data Types: uuid, boolean, int, float, number, zero_one, id_increment, color
|
|
150
|
-
Text: sentence, paragraph
|
|
174
|
+
Data Types: uuid, boolean, int, float, number, zero_one, id_increment, color, hex
|
|
175
|
+
Text: sentence, paragraph, word, slug
|
|
151
176
|
```
|
|
152
177
|
|
|
153
178
|
## 🎛️ API Reference
|
|
@@ -299,6 +324,42 @@ For very large batches (>100K records), consider:
|
|
|
299
324
|
- Using `generateBatchWithProgress` to show progress
|
|
300
325
|
- Running in a worker thread if in browser
|
|
301
326
|
|
|
327
|
+
## 📚 Complete Documentation
|
|
328
|
+
|
|
329
|
+
For detailed examples and advanced usage, see [USAGE.md](./USAGE.md)
|
|
330
|
+
|
|
331
|
+
## 🔧 Import Methods
|
|
332
|
+
|
|
333
|
+
### CommonJS
|
|
334
|
+
```javascript
|
|
335
|
+
const genata = require('@drichdev/genata');
|
|
336
|
+
genata.email();
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### ES Modules
|
|
340
|
+
```javascript
|
|
341
|
+
import genata from '@drichdev/genata';
|
|
342
|
+
genata.email();
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### TypeScript
|
|
346
|
+
```typescript
|
|
347
|
+
import genata, { type FieldDefinition } from '@drichdev/genata';
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### Next.js / React
|
|
351
|
+
```typescript
|
|
352
|
+
import genata from '@drichdev/genata';
|
|
353
|
+
|
|
354
|
+
export default function Component() {
|
|
355
|
+
const data = genata.email();
|
|
356
|
+
return <div>{data}</div>;
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
**⚠️ Note**: If you get a "Module type is not specified" warning, add `"type": "module"` to your `package.json` or use CommonJS require instead.
|
|
361
|
+
|
|
302
362
|
---
|
|
303
363
|
|
|
304
364
|
Made with ❤️ by Drichdev
|
|
365
|
+
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* - genata.person.firstName() - generates a first name
|
|
8
8
|
* - genata.generateBatch([...]) - generates multiple records
|
|
9
9
|
*/
|
|
10
|
-
import { PersonGenerators, LocationGenerators, InternetGenerators, CompanyGenerators, DateGenerators, DataTypeGenerators, TextGenerators, generateBatch, generateBatchWithProgress } from "./generators";
|
|
11
10
|
import type { FieldDefinition, BatchGeneratorOptions } from "./types";
|
|
12
11
|
/**
|
|
13
12
|
* Main Genata API
|
|
@@ -89,8 +88,5 @@ declare const genata: {
|
|
|
89
88
|
resetSeed: () => void;
|
|
90
89
|
setLocale: (locale: string) => void;
|
|
91
90
|
};
|
|
92
|
-
export
|
|
93
|
-
export * from "./types";
|
|
94
|
-
export * from "./validators";
|
|
95
|
-
export { PersonGenerators, LocationGenerators, InternetGenerators, CompanyGenerators, DateGenerators, DataTypeGenerators, TextGenerators, generateBatch, generateBatchWithProgress, };
|
|
91
|
+
export = genata;
|
|
96
92
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAItE;;GAEG;AACH,QAAA,MAAM,MAAM;;;;;;yBAOW;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;kBAOnC,CAAC;;;;;;;;;;;;;;;;;;;;;;kBAkCqoD,CAAC;;;;;;;;;eAAq+B,CAAC;eAAa,CAAC;;;eAAkW,CAAC;eAAa,CAAC;oBAAkB,CAAC;;;kBAAwhB,CAAC;;;;;;;qBAA2uB,CAAC;;;;;4BA1B/vI,eAAe,EAAE,YACf,qBAAqB;wCAIvB,eAAe,EAAE,YACf,qBAAqB,GAAG;QAAE,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE;oBAI/D,MAAM;;wBASF,MAAM;CAI3B,CAAC;AAEF,SAAS,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,32 +8,7 @@
|
|
|
8
8
|
* - genata.person.firstName() - generates a first name
|
|
9
9
|
* - genata.generateBatch([...]) - generates multiple records
|
|
10
10
|
*/
|
|
11
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
-
if (k2 === undefined) k2 = k;
|
|
13
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
-
}
|
|
17
|
-
Object.defineProperty(o, k2, desc);
|
|
18
|
-
}) : (function(o, m, k, k2) {
|
|
19
|
-
if (k2 === undefined) k2 = k;
|
|
20
|
-
o[k2] = m[k];
|
|
21
|
-
}));
|
|
22
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
23
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.generateBatchWithProgress = exports.generateBatch = exports.TextGenerators = exports.DataTypeGenerators = exports.DateGenerators = exports.CompanyGenerators = exports.InternetGenerators = exports.LocationGenerators = exports.PersonGenerators = void 0;
|
|
27
11
|
const generators_1 = require("./generators");
|
|
28
|
-
Object.defineProperty(exports, "PersonGenerators", { enumerable: true, get: function () { return generators_1.PersonGenerators; } });
|
|
29
|
-
Object.defineProperty(exports, "LocationGenerators", { enumerable: true, get: function () { return generators_1.LocationGenerators; } });
|
|
30
|
-
Object.defineProperty(exports, "InternetGenerators", { enumerable: true, get: function () { return generators_1.InternetGenerators; } });
|
|
31
|
-
Object.defineProperty(exports, "CompanyGenerators", { enumerable: true, get: function () { return generators_1.CompanyGenerators; } });
|
|
32
|
-
Object.defineProperty(exports, "DateGenerators", { enumerable: true, get: function () { return generators_1.DateGenerators; } });
|
|
33
|
-
Object.defineProperty(exports, "DataTypeGenerators", { enumerable: true, get: function () { return generators_1.DataTypeGenerators; } });
|
|
34
|
-
Object.defineProperty(exports, "TextGenerators", { enumerable: true, get: function () { return generators_1.TextGenerators; } });
|
|
35
|
-
Object.defineProperty(exports, "generateBatch", { enumerable: true, get: function () { return generators_1.generateBatch; } });
|
|
36
|
-
Object.defineProperty(exports, "generateBatchWithProgress", { enumerable: true, get: function () { return generators_1.generateBatchWithProgress; } });
|
|
37
12
|
const faker_1 = require("./utils/faker");
|
|
38
13
|
const validators_1 = require("./validators");
|
|
39
14
|
/**
|
|
@@ -72,6 +47,4 @@ const genata = {
|
|
|
72
47
|
(0, faker_1.initializeFaker)({ locale });
|
|
73
48
|
},
|
|
74
49
|
};
|
|
75
|
-
exports
|
|
76
|
-
__exportStar(require("./types"), exports);
|
|
77
|
-
__exportStar(require("./validators"), exports);
|
|
50
|
+
module.exports = genata;
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drichdev/genata",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Generate realistic fake data easily",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
-
"module": "dist/index.esm.js",
|
|
8
7
|
"files": [
|
|
9
8
|
"dist"
|
|
10
9
|
],
|
|
@@ -22,7 +21,7 @@
|
|
|
22
21
|
"testing",
|
|
23
22
|
"data-generator"
|
|
24
23
|
],
|
|
25
|
-
"author": "
|
|
24
|
+
"author": "Drichdev",
|
|
26
25
|
"license": "MIT",
|
|
27
26
|
"dependencies": {
|
|
28
27
|
"@faker-js/faker": "^10.0.0"
|