aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/helpers/index.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts
index 593d1ede..b21f13e7 100644
--- a/src/modules/helpers/index.ts
+++ b/src/modules/helpers/index.ts
@@ -1129,17 +1129,19 @@ export class SimpleHelpersModule extends SimpleModuleBase {
* @template TResult The type of elements.
*
* @param method The method used to generate the values.
+ * The method will be called with `(_, index)`, to allow using the index in the generated value e.g. as id.
* @param options The optional options object.
* @param options.count The number or range of elements to generate. Defaults to `3`.
*
* @example
- * faker.helpers.multiple(faker.person.firstName) // [ 'Aniya', 'Norval', 'Dallin' ]
- * faker.helpers.multiple(faker.person.firstName, { count: 3 }) // [ 'Santos', 'Lavinia', 'Lavinia' ]
+ * faker.helpers.multiple(() => faker.person.firstName()) // [ 'Aniya', 'Norval', 'Dallin' ]
+ * faker.helpers.multiple(() => faker.person.firstName(), { count: 3 }) // [ 'Santos', 'Lavinia', 'Lavinia' ]
+ * faker.helpers.multiple((_, i) => `${faker.color.human()}-${i + 1}`) // [ 'orange-1', 'orchid-2', 'sky blue-3' ]
*
* @since 8.0.0
*/
multiple<const TResult>(
- method: () => TResult,
+ method: (v: unknown, index: number) => TResult,
options: {
/**
* The number or range of elements to generate.