aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2022-02-06 12:09:36 +0100
committerGitHub <[email protected]>2022-02-06 12:09:36 +0100
commit68995cb3c2aed74c315666d7ae92911d2d7d3173 (patch)
treee09d1e5e89a8c534f6f6eb8d8e524e44265d3159 /src
parentec5550657b6b4e2f62032e9f4175ec2ac8307ee0 (diff)
downloadfaker-68995cb3c2aed74c315666d7ae92911d2d7d3173.tar.xz
faker-68995cb3c2aed74c315666d7ae92911d2d7d3173.zip
docs: improve unique jsdocs (#439)
Diffstat (limited to 'src')
-rw-r--r--src/unique.ts19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/unique.ts b/src/unique.ts
index 7379af1d..3084da4b 100644
--- a/src/unique.ts
+++ b/src/unique.ts
@@ -1,5 +1,8 @@
import * as uniqueExec from './vendor/unique';
+/**
+ * Module to generate unique entries.
+ */
export class Unique {
// maximum time unique.exec will attempt to run before aborting
maxTime = 10;
@@ -21,9 +24,21 @@ export class Unique {
}
/**
- * unique
+ * Generates a unique result using the results of the given method.
+ * Used unique entries will be stored internally and filtered from subsequent calls.
*
- * @method unique
+ * @param method The method used to generate the values.
+ * @param args The arguments used to call the method.
+ * @param opts The optional options used to configure this method.
+ * @param opts.startTime The time this execution stared. This will be ignored/overwritten.
+ * @param opts.maxTime The time this method may take before throwing an error.
+ * @param opts.maxRetries The total number of attempts to try before throwing an error.
+ * @param opts.currentIterations The current attempt. This will be ignored/overwritten.
+ * @param opts.exclude The value or values that should be excluded/skipped.
+ * @param opts.compare The function used to determine whether a value was already returned.
+ *
+ * @example
+ * faker.unique(faker.name.firstName())
*/
unique<Method extends (args: Args) => string, Args extends any[]>(
method: Method,