Skip to content

Commit 0b2fa1a

Browse files
authored
feat(number)!: change int default params (#1643)
1 parent b7dbfac commit 0b2fa1a

File tree

5 files changed

+62
-62
lines changed

5 files changed

+62
-62
lines changed

src/modules/number/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class NumberModule {
2222
*
2323
* @param options Maximum value or options object. Defaults to `{}`.
2424
* @param options.min Lower bound for generated number. Defaults to `0`.
25-
* @param options.max Upper bound for generated number. Defaults to `min + 99999`.
25+
* @param options.max Upper bound for generated number. Defaults to `Number.MAX_SAFE_INTEGER`.
2626
*
2727
* @throws When options define `max < min`.
2828
*
@@ -42,7 +42,7 @@ export class NumberModule {
4242
options = { max: options };
4343
}
4444

45-
const { min = 0, max = min + 99999 } = options;
45+
const { min = 0, max = Number.MAX_SAFE_INTEGER } = options;
4646
const effectiveMin = Math.ceil(min);
4747
const effectiveMax = Math.floor(max);
4848

test/__snapshots__/datatype.spec.ts.snap

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ exports[`datatype > 42 > array > noArgs 1`] = `
44
[
55
"ky2eiXX/J/",
66
7-
72199,
8-
93855,
7+
6503186795855872,
8+
8453731307749376,
99
"!1}2Z=YQ!I",
1010
"<QYF-%<{C6",
1111
")jZ3DP|XL%",
12-
60754,
13-
17052,
12+
5472277529362432,
13+
1535944771502080,
1414
"'\\"yxzUlD=\\"",
1515
]
1616
`;
@@ -19,17 +19,17 @@ exports[`datatype > 42 > array > with length 1`] = `
1919
[
2020
"ky2eiXX/J/",
2121
22-
72199,
23-
93855,
22+
6503186795855872,
23+
8453731307749376,
2424
]
2525
`;
2626
2727
exports[`datatype > 42 > array > with length range 1`] = `
2828
[
29-
95071,
29+
8563273238577152,
3030
"eiXX/J/*&K",
31-
33370,
32-
14286,
31+
3005779955154944,
32+
1286829863075840,
3333
]
3434
`;
3535
@@ -93,7 +93,7 @@ exports[`datatype > 42 > hexadecimal > with length, prefix, and casing 1`] = `"0
9393
9494
exports[`datatype > 42 > hexadecimal > with prefix 1`] = `"0x8"`;
9595
96-
exports[`datatype > 42 > json 1`] = `"{\\"foo\\":\\"ky2eiXX/J/\\",\\"bar\\":\\"&Kq@X.b]\\\\\\"&\\",\\"bike\\":72199,\\"a\\":93855,\\"b\\":\\"!1}2Z=YQ!I\\",\\"name\\":\\"<QYF-%<{C6\\",\\"prop\\":\\")jZ3DP|XL%\\"}"`;
96+
exports[`datatype > 42 > json 1`] = `"{\\"foo\\":\\"ky2eiXX/J/\\",\\"bar\\":\\"&Kq@X.b]\\\\\\"&\\",\\"bike\\":6503186795855872,\\"a\\":8453731307749376,\\"b\\":\\"!1}2Z=YQ!I\\",\\"name\\":\\"<QYF-%<{C6\\",\\"prop\\":\\")jZ3DP|XL%\\"}"`;
9797

9898
exports[`datatype > 42 > number > noArgs 1`] = `37454`;
9999

@@ -131,23 +131,23 @@ exports[`datatype > 42 > uuid 5`] = `"d95f4984-24c2-410f-ac63-400d3bbbcc91"`;
131131

132132
exports[`datatype > 1211 > array > noArgs 1`] = `
133133
[
134-
45901,
135-
77826,
134+
4134441414819840,
135+
7010029022478336,
136136
"-}$_/\`4hHA",
137137
"afl\\"h^]dnw",
138138
"<q|p|5KWu3",
139139
"CZ|Jh!E=x\\"",
140-
42131,
141-
15894,
140+
3794869965291520,
141+
1431627091673088,
142142
"V<1bEQuA|p",
143143
"DW9F=V1(U7",
144144
]
145145
`;
146146

147147
exports[`datatype > 1211 > array > with length 1`] = `
148148
[
149-
45901,
150-
77826,
149+
4134441414819840,
150+
7010029022478336,
151151
"-}$_/\`4hHA",
152152
"afl\\"h^]dnw",
153153
]
@@ -156,9 +156,9 @@ exports[`datatype > 1211 > array > with length 1`] = `
156156
exports[`datatype > 1211 > array > with length range 1`] = `
157157
[
158158
"ti5-}$_/\`4",
159-
42075,
159+
3789861976801280,
160160
"0afl\\"h^]dn",
161-
43503,
161+
3918465303838720,
162162
"q|p|5KWu3/",
163163
]
164164
`;
@@ -223,7 +223,7 @@ exports[`datatype > 1211 > hexadecimal > with length, prefix, and casing 1`] = `
223223

224224
exports[`datatype > 1211 > hexadecimal > with prefix 1`] = `"0xE"`;
225225

226-
exports[`datatype > 1211 > json 1`] = `"{\\"foo\\":45901,\\"bar\\":77826,\\"bike\\":\\"-}$_/\`4hHA\\",\\"a\\":\\"afl\\\\\\"h^]dnw\\",\\"b\\":\\"<q|p|5KWu3\\",\\"name\\":\\"CZ|Jh!E=x\\\\\\"\\",\\"prop\\":42131}"`;
226+
exports[`datatype > 1211 > json 1`] = `"{\\"foo\\":4134441414819840,\\"bar\\":7010029022478336,\\"bike\\":\\"-}$_/\`4hHA\\",\\"a\\":\\"afl\\\\\\"h^]dnw\\",\\"b\\":\\"<q|p|5KWu3\\",\\"name\\":\\"CZ|Jh!E=x\\\\\\"\\",\\"prop\\":3794869965291520}"`;
227227

228228
exports[`datatype > 1211 > number > noArgs 1`] = `92852`;
229229

@@ -262,32 +262,32 @@ exports[`datatype > 1211 > uuid 5`] = `"7b91ce88-effb-4d1d-93bb-ad759e00b86c"`;
262262
exports[`datatype > 1337 > array > noArgs 1`] = `
263263
[
264264
"U/4:SK$>6Q",
265-
26194,
265+
2359372120326144,
266266
"{:e=+kD)[B",
267267
"e|/Jqjjj!B",
268268
"GDWQgC2M;q",
269-
40502,
270-
44050,
269+
3648103756333056,
270+
3967686428065792,
271271
".Gm3tRwnZ2",
272-
95735,
273-
42541,
272+
8623125245722624,
273+
3831794621218816,
274274
]
275275
`;
276276
277277
exports[`datatype > 1337 > array > with length 1`] = `
278278
[
279279
"U/4:SK$>6Q",
280-
26194,
280+
2359372120326144,
281281
"{:e=+kD)[B",
282282
"e|/Jqjjj!B",
283283
]
284284
`;
285285
286286
exports[`datatype > 1337 > array > with length range 1`] = `
287287
[
288-
15868,
288+
1429298200182784,
289289
":SK$>6QX9@",
290-
27048,
290+
2436284417048576,
291291
]
292292
`;
293293
@@ -351,7 +351,7 @@ exports[`datatype > 1337 > hexadecimal > with length, prefix, and casing 1`] = `
351351
352352
exports[`datatype > 1337 > hexadecimal > with prefix 1`] = `"0x5"`;
353353
354-
exports[`datatype > 1337 > json 1`] = `"{\\"foo\\":\\"U/4:SK$>6Q\\",\\"bar\\":26194,\\"bike\\":\\"{:e=+kD)[B\\",\\"a\\":\\"e|/Jqjjj!B\\",\\"b\\":\\"GDWQgC2M;q\\",\\"name\\":40502,\\"prop\\":44050}"`;
354+
exports[`datatype > 1337 > json 1`] = `"{\\"foo\\":\\"U/4:SK$>6Q\\",\\"bar\\":2359372120326144,\\"bike\\":\\"{:e=+kD)[B\\",\\"a\\":\\"e|/Jqjjj!B\\",\\"b\\":\\"GDWQgC2M;q\\",\\"name\\":3648103756333056,\\"prop\\":3967686428065792}"`;
355355
356356
exports[`datatype > 1337 > number > noArgs 1`] = `26202`;
357357

test/__snapshots__/helpers.spec.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ exports[`helpers > 42 > slugify > noArgs 1`] = `""`;
155155

156156
exports[`helpers > 42 > slugify > some string 1`] = `"hello-world"`;
157157

158-
exports[`helpers > 42 > unique > with () => number 1`] = `37454`;
158+
exports[`helpers > 42 > unique > with () => number 1`] = `3373557438480384`;
159159

160160
exports[`helpers > 42 > unique > with () => number and args 1`] = `19`;
161161

@@ -340,7 +340,7 @@ exports[`helpers > 1211 > slugify > noArgs 1`] = `""`;
340340

341341
exports[`helpers > 1211 > slugify > some string 1`] = `"hello-world"`;
342342

343-
exports[`helpers > 1211 > unique > with () => number 1`] = `92852`;
343+
exports[`helpers > 1211 > unique > with () => number 1`] = `8363366036799488`;
344344

345345
exports[`helpers > 1211 > unique > with () => number and args 1`] = `47`;
346346

@@ -508,7 +508,7 @@ exports[`helpers > 1337 > slugify > noArgs 1`] = `""`;
508508

509509
exports[`helpers > 1337 > slugify > some string 1`] = `"hello-world"`;
510510

511-
exports[`helpers > 1337 > unique > with () => number 1`] = `26202`;
511+
exports[`helpers > 1337 > unique > with () => number 1`] = `2360108468142080`;
512512

513513
exports[`helpers > 1337 > unique > with () => number and args 1`] = `13`;
514514

test/__snapshots__/image.spec.ts.snap

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ exports[`image > 42 > avatarGitHub 1`] = `"https://avatars.githubusercontent.com
66

77
exports[`image > 42 > avatarLegacy 1`] = `"https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/468.jpg"`;
88

9-
exports[`image > 42 > url > noArgs 1`] = `"https://loremflickr.com/640/480?lock=79654"`;
9+
exports[`image > 42 > url > noArgs 1`] = `"https://loremflickr.com/640/480?lock=7174621373661184"`;
1010

11-
exports[`image > 42 > url > with height 1`] = `"https://loremflickr.com/640/128?lock=79654"`;
11+
exports[`image > 42 > url > with height 1`] = `"https://loremflickr.com/640/128?lock=7174621373661184"`;
1212

13-
exports[`image > 42 > url > with width 1`] = `"https://loremflickr.com/128/480?lock=79654"`;
13+
exports[`image > 42 > url > with width 1`] = `"https://loremflickr.com/128/480?lock=7174621373661184"`;
1414

15-
exports[`image > 42 > url > with width and height 1`] = `"https://loremflickr.com/128/128?lock=79654"`;
15+
exports[`image > 42 > url > with width and height 1`] = `"https://loremflickr.com/128/128?lock=7174621373661184"`;
1616

17-
exports[`image > 42 > urlLoremFlickr > noArgs 1`] = `"https://loremflickr.com/640/480?lock=37454"`;
17+
exports[`image > 42 > urlLoremFlickr > noArgs 1`] = `"https://loremflickr.com/640/480?lock=3373557438480384"`;
1818

19-
exports[`image > 42 > urlLoremFlickr > with all options 1`] = `"https://loremflickr.com/128/128/cats?lock=37454"`;
19+
exports[`image > 42 > urlLoremFlickr > with all options 1`] = `"https://loremflickr.com/128/128/cats?lock=3373557438480384"`;
2020

21-
exports[`image > 42 > urlLoremFlickr > with category 1`] = `"https://loremflickr.com/640/480/cats?lock=37454"`;
21+
exports[`image > 42 > urlLoremFlickr > with category 1`] = `"https://loremflickr.com/640/480/cats?lock=3373557438480384"`;
2222

23-
exports[`image > 42 > urlLoremFlickr > with height 1`] = `"https://loremflickr.com/640/128?lock=37454"`;
23+
exports[`image > 42 > urlLoremFlickr > with height 1`] = `"https://loremflickr.com/640/128?lock=3373557438480384"`;
2424

25-
exports[`image > 42 > urlLoremFlickr > with width 1`] = `"https://loremflickr.com/128/480?lock=37454"`;
25+
exports[`image > 42 > urlLoremFlickr > with width 1`] = `"https://loremflickr.com/128/480?lock=3373557438480384"`;
2626

27-
exports[`image > 42 > urlLoremFlickr > with width and height 1`] = `"https://loremflickr.com/128/128?lock=37454"`;
27+
exports[`image > 42 > urlLoremFlickr > with width and height 1`] = `"https://loremflickr.com/128/128?lock=3373557438480384"`;
2828

2929
exports[`image > 42 > urlPicsumPhotos > noArgs 1`] = `"https://picsum.photos/id/374/640/480"`;
3030

@@ -74,17 +74,17 @@ exports[`image > 1211 > url > with width 1`] = `"https://picsum.photos/id/459/12
7474

7575
exports[`image > 1211 > url > with width and height 1`] = `"https://picsum.photos/id/459/128/128"`;
7676

77-
exports[`image > 1211 > urlLoremFlickr > noArgs 1`] = `"https://loremflickr.com/640/480?lock=92852"`;
77+
exports[`image > 1211 > urlLoremFlickr > noArgs 1`] = `"https://loremflickr.com/640/480?lock=8363366036799488"`;
7878

79-
exports[`image > 1211 > urlLoremFlickr > with all options 1`] = `"https://loremflickr.com/128/128/cats?lock=92852"`;
79+
exports[`image > 1211 > urlLoremFlickr > with all options 1`] = `"https://loremflickr.com/128/128/cats?lock=8363366036799488"`;
8080

81-
exports[`image > 1211 > urlLoremFlickr > with category 1`] = `"https://loremflickr.com/640/480/cats?lock=92852"`;
81+
exports[`image > 1211 > urlLoremFlickr > with category 1`] = `"https://loremflickr.com/640/480/cats?lock=8363366036799488"`;
8282

83-
exports[`image > 1211 > urlLoremFlickr > with height 1`] = `"https://loremflickr.com/640/128?lock=92852"`;
83+
exports[`image > 1211 > urlLoremFlickr > with height 1`] = `"https://loremflickr.com/640/128?lock=8363366036799488"`;
8484

85-
exports[`image > 1211 > urlLoremFlickr > with width 1`] = `"https://loremflickr.com/128/480?lock=92852"`;
85+
exports[`image > 1211 > urlLoremFlickr > with width 1`] = `"https://loremflickr.com/128/480?lock=8363366036799488"`;
8686

87-
exports[`image > 1211 > urlLoremFlickr > with width and height 1`] = `"https://loremflickr.com/128/128?lock=92852"`;
87+
exports[`image > 1211 > urlLoremFlickr > with width and height 1`] = `"https://loremflickr.com/128/128?lock=8363366036799488"`;
8888

8989
exports[`image > 1211 > urlPicsumPhotos > noArgs 1`] = `"https://picsum.photos/id/929/640/480"`;
9090

@@ -126,25 +126,25 @@ exports[`image > 1337 > avatarGitHub 1`] = `"https://avatars.githubusercontent.c
126126

127127
exports[`image > 1337 > avatarLegacy 1`] = `"https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/327.jpg"`;
128128

129-
exports[`image > 1337 > url > noArgs 1`] = `"https://loremflickr.com/640/480?lock=56052"`;
129+
exports[`image > 1337 > url > noArgs 1`] = `"https://loremflickr.com/640/480?lock=5048803172286464"`;
130130

131-
exports[`image > 1337 > url > with height 1`] = `"https://loremflickr.com/640/128?lock=56052"`;
131+
exports[`image > 1337 > url > with height 1`] = `"https://loremflickr.com/640/128?lock=5048803172286464"`;
132132

133-
exports[`image > 1337 > url > with width 1`] = `"https://loremflickr.com/128/480?lock=56052"`;
133+
exports[`image > 1337 > url > with width 1`] = `"https://loremflickr.com/128/480?lock=5048803172286464"`;
134134

135-
exports[`image > 1337 > url > with width and height 1`] = `"https://loremflickr.com/128/128?lock=56052"`;
135+
exports[`image > 1337 > url > with width and height 1`] = `"https://loremflickr.com/128/128?lock=5048803172286464"`;
136136

137-
exports[`image > 1337 > urlLoremFlickr > noArgs 1`] = `"https://loremflickr.com/640/480?lock=26202"`;
137+
exports[`image > 1337 > urlLoremFlickr > noArgs 1`] = `"https://loremflickr.com/640/480?lock=2360108468142080"`;
138138

139-
exports[`image > 1337 > urlLoremFlickr > with all options 1`] = `"https://loremflickr.com/128/128/cats?lock=26202"`;
139+
exports[`image > 1337 > urlLoremFlickr > with all options 1`] = `"https://loremflickr.com/128/128/cats?lock=2360108468142080"`;
140140

141-
exports[`image > 1337 > urlLoremFlickr > with category 1`] = `"https://loremflickr.com/640/480/cats?lock=26202"`;
141+
exports[`image > 1337 > urlLoremFlickr > with category 1`] = `"https://loremflickr.com/640/480/cats?lock=2360108468142080"`;
142142

143-
exports[`image > 1337 > urlLoremFlickr > with height 1`] = `"https://loremflickr.com/640/128?lock=26202"`;
143+
exports[`image > 1337 > urlLoremFlickr > with height 1`] = `"https://loremflickr.com/640/128?lock=2360108468142080"`;
144144

145-
exports[`image > 1337 > urlLoremFlickr > with width 1`] = `"https://loremflickr.com/128/480?lock=26202"`;
145+
exports[`image > 1337 > urlLoremFlickr > with width 1`] = `"https://loremflickr.com/128/480?lock=2360108468142080"`;
146146

147-
exports[`image > 1337 > urlLoremFlickr > with width and height 1`] = `"https://loremflickr.com/128/128?lock=26202"`;
147+
exports[`image > 1337 > urlLoremFlickr > with width and height 1`] = `"https://loremflickr.com/128/128?lock=2360108468142080"`;
148148

149149
exports[`image > 1337 > urlPicsumPhotos > noArgs 1`] = `"https://picsum.photos/id/262/640/480"`;
150150

test/__snapshots__/number.spec.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ exports[`number > 42 > hex > with options 1`] = `"4"`;
3030

3131
exports[`number > 42 > hex > with value 1`] = `"0"`;
3232

33-
exports[`number > 42 > int > noArgs 1`] = `37454`;
33+
exports[`number > 42 > int > noArgs 1`] = `3373557438480384`;
3434

3535
exports[`number > 42 > int > with options 1`] = `4`;
3636

@@ -66,7 +66,7 @@ exports[`number > 1211 > hex > with options 1`] = `"a"`;
6666

6767
exports[`number > 1211 > hex > with value 1`] = `"1"`;
6868

69-
exports[`number > 1211 > int > noArgs 1`] = `92852`;
69+
exports[`number > 1211 > int > noArgs 1`] = `8363366036799488`;
7070

7171
exports[`number > 1211 > int > with options 1`] = `10`;
7272

@@ -102,7 +102,7 @@ exports[`number > 1337 > hex > with options 1`] = `"2"`;
102102

103103
exports[`number > 1337 > hex > with value 1`] = `"0"`;
104104

105-
exports[`number > 1337 > int > noArgs 1`] = `26202`;
105+
exports[`number > 1337 > int > noArgs 1`] = `2360108468142080`;
106106

107107
exports[`number > 1337 > int > with options 1`] = `2`;
108108

0 commit comments

Comments
 (0)