aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2023-01-21 20:38:51 +0100
committerGitHub <[email protected]>2023-01-21 19:38:51 +0000
commitf839ae23270773b476ee39610a0b399e1432bac7 (patch)
tree79bfa17779fbd6e7abdefcfbf040bab1166f6583 /src
parent440325eb0f53d6fd1c13e2c955984accd8f76143 (diff)
downloadfaker-f839ae23270773b476ee39610a0b399e1432bac7.tar.xz
faker-f839ae23270773b476ee39610a0b399e1432bac7.zip
docs: unwrap complex array params (#1753)
Diffstat (limited to 'src')
-rw-r--r--src/modules/helpers/index.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts
index 6f636052..8d10ced9 100644
--- a/src/modules/helpers/index.ts
+++ b/src/modules/helpers/index.ts
@@ -506,6 +506,8 @@ export class HelpersModule {
*
* @template T The type of the entries to pick from.
* @param array Array to pick the value from.
+ * @param array[].weight The weight of the value.
+ * @param array[].value The value to pick.
*
* @example
* faker.helpers.weightedArrayElement([{ weight: 5, value: 'sunny' }, { weight: 4, value: 'rainy' }, { weight: 1, value: 'snowy' }]) // 'sunny', 50% of the time, 'rainy' 40% of the time, 'snowy' 10% of the time
@@ -513,7 +515,16 @@ export class HelpersModule {
* @since 8.0.0
*/
weightedArrayElement<T>(
- array: ReadonlyArray<{ weight: number; value: T }>
+ array: ReadonlyArray<{
+ /**
+ * The weight of the value.
+ */
+ weight: number;
+ /**
+ * The value to pick.
+ */
+ value: T;
+ }>
): T {
if (array.length === 0) {
throw new FakerError(