diff options
| author | Shinigami <[email protected]> | 2022-01-24 19:30:46 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-01-24 19:30:46 +0100 |
| commit | a3792251766ed9a87a59c760ea87f64792e54caa (patch) | |
| tree | 9a9dc7ee3b67bf08f9db7b14326385f118d39ca0 /src/unique.ts | |
| parent | be6ea47ffab857e3328bc620502b31732d53d82d (diff) | |
| download | faker-a3792251766ed9a87a59c760ea87f64792e54caa.tar.xz faker-a3792251766ed9a87a59c760ea87f64792e54caa.zip | |
chore: migrate vendor (#254)
Diffstat (limited to 'src/unique.ts')
| -rw-r--r-- | src/unique.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/unique.ts b/src/unique.ts index c077ea58..382d2e2d 100644 --- a/src/unique.ts +++ b/src/unique.ts @@ -1,4 +1,4 @@ -const uniqueExec = require('../vendor/unique'); +import * as uniqueExec from './vendor/unique'; export class Unique { // maximum time unique.exec will attempt to run before aborting @@ -25,17 +25,18 @@ export class Unique { * * @method unique */ - unique( - method: any, - args: any, + unique<Method extends (args: Args) => string, Args extends any[]>( + method: Method, + args: Args, opts?: { startTime?: number; maxTime?: number; maxRetries?: number; currentIterations?: number; - [key: string]: any; + exclude?: string | string[]; + compare?: (obj: Record<string, string>, key: string) => 0 | -1; } - ): any { + ): string { opts ||= {}; opts.startTime = new Date().getTime(); if (typeof opts.maxTime !== 'number') { |
