Skip to content

Commit 68995cb

Browse files
authored
docs: improve unique jsdocs (#439)
1 parent ec55506 commit 68995cb

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/unique.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import * as uniqueExec from './vendor/unique';
22

3+
/**
4+
* Module to generate unique entries.
5+
*/
36
export class Unique {
47
// maximum time unique.exec will attempt to run before aborting
58
maxTime = 10;
@@ -21,9 +24,21 @@ export class Unique {
2124
}
2225

2326
/**
24-
* unique
27+
* Generates a unique result using the results of the given method.
28+
* Used unique entries will be stored internally and filtered from subsequent calls.
2529
*
26-
* @method unique
30+
* @param method The method used to generate the values.
31+
* @param args The arguments used to call the method.
32+
* @param opts The optional options used to configure this method.
33+
* @param opts.startTime The time this execution stared. This will be ignored/overwritten.
34+
* @param opts.maxTime The time this method may take before throwing an error.
35+
* @param opts.maxRetries The total number of attempts to try before throwing an error.
36+
* @param opts.currentIterations The current attempt. This will be ignored/overwritten.
37+
* @param opts.exclude The value or values that should be excluded/skipped.
38+
* @param opts.compare The function used to determine whether a value was already returned.
39+
*
40+
* @example
41+
* faker.unique(faker.name.firstName())
2742
*/
2843
unique<Method extends (args: Args) => string, Args extends any[]>(
2944
method: Method,

0 commit comments

Comments
 (0)