Can the random number of element to be picked in faker.helper.arrayElements() be zero? #1002
-
If I left the count parameter in |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This is possible in some edge cases:
So in the case, you stated this will not happen, since the count parameter will default to a random value between 1 and the array length faker/src/modules/helpers/index.ts Line 452 in 9432edd |
Beta Was this translation helpful? Give feedback.
This is possible in some edge cases:
count
parameter of0
count
parameter of less than0
(the value will get defaulted to 0)faker/src/modules/helpers/index.ts
Lines 455 to 457 in 9432edd
array
parameter an empty arrayfaker/src/modules/helpers/index.ts
Lines 453 to 455 in 9432edd
So in the case, you stated this will not happen, since the count parameter will default to a random value between 1 and the array length
faker/src/modules/helpers/index.ts
Line 452 in 9432edd