@stacksjs/faker 0.72.34 → 0.72.37
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/index.d.ts +4 -32
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -2,43 +2,15 @@ import { faker as baseFaker } from '@stacksjs/ts-faker';
|
|
|
2
2
|
declare function randomCount(range: NumberRange, minimum?: number): number;
|
|
3
3
|
// datatype module for boolean, number generation (compatibility with @faker-js/faker)
|
|
4
4
|
declare const datatype: DatatypeCompatibility;
|
|
5
|
-
declare const number: EnhancedNumber
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
number.float = (options?: { min?: number, max?: number, precision?: number, fractionDigits?: number }): number => {
|
|
10
|
-
if (!options) return baseFaker.number.float()
|
|
11
|
-
const { fractionDigits, ...rest } = options
|
|
12
|
-
return baseFaker.number.float({
|
|
13
|
-
...rest,
|
|
14
|
-
precision: rest.precision ?? fractionDigits,
|
|
15
|
-
})
|
|
16
|
-
};
|
|
17
|
-
declare const string: EnhancedString
|
|
18
|
-
string.alpha = (options?: number | { length?: number, casing?: 'upper' | 'lower' | 'mixed' }): string => {
|
|
19
|
-
return baseFaker.string.alpha(typeof options === 'number' ? { length: options } : options)
|
|
20
|
-
}
|
|
21
|
-
string.alphanumeric = (options?: number | { length?: number, casing?: 'upper' | 'lower' | 'mixed' }): string => {
|
|
22
|
-
return baseFaker.string.alphanumeric(typeof options === 'number' ? { length: options } : options)
|
|
23
|
-
};
|
|
24
|
-
declare const finance: EnhancedFinance
|
|
25
|
-
finance.creditCardNumber = (options?: string | { issuer?: string, formatted?: boolean }): string => {
|
|
26
|
-
if (typeof options !== 'string') return baseFaker.finance.creditCardNumber(options)
|
|
27
|
-
return options.replace(/#/g, () => baseFaker.string.numeric(1))
|
|
28
|
-
};
|
|
5
|
+
declare const number: EnhancedNumber;
|
|
6
|
+
declare const string: EnhancedString;
|
|
7
|
+
declare const finance: EnhancedFinance;
|
|
29
8
|
/**
|
|
30
9
|
* Keep seeded image URLs usable in real UI previews. The underlying faker's
|
|
31
10
|
* generic URL still targets the retired via.placeholder.com service, so
|
|
32
11
|
* factories otherwise persist broken images into commerce and content data.
|
|
33
12
|
*/
|
|
34
|
-
declare const image: typeof baseFaker.image
|
|
35
|
-
image.url = (options?: { width?: number, height?: number }): string => {
|
|
36
|
-
const width = options?.width ?? 640
|
|
37
|
-
const height = options?.height ?? 480
|
|
38
|
-
const seed = baseFaker.string.alphanumeric({ length: 12 }).toLowerCase()
|
|
39
|
-
|
|
40
|
-
return `https://picsum.photos/seed/${seed}/${width}/${height}`
|
|
41
|
-
};
|
|
13
|
+
declare const image: typeof baseFaker.image;
|
|
42
14
|
/**
|
|
43
15
|
* location module (alias to address for @faker-js/faker compatibility)
|
|
44
16
|
* @defaultValue
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/faker",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.72.
|
|
4
|
+
"version": "0.72.37",
|
|
5
5
|
"description": "Faker functions.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": [
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"prepublishOnly": "bun run build"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@stacksjs/cli": "0.72.
|
|
62
|
-
"@stacksjs/config": "0.72.
|
|
61
|
+
"@stacksjs/cli": "0.72.37",
|
|
62
|
+
"@stacksjs/config": "0.72.37",
|
|
63
63
|
"better-dx": "^0.2.24",
|
|
64
64
|
"@stacksjs/ts-faker": "^0.1.7"
|
|
65
65
|
},
|