diff options
| author | Shinigami <[email protected]> | 2023-04-01 11:52:31 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-04-01 09:52:31 +0000 |
| commit | dbbc785f6a626e84fe0925504b4f267fd1a8e00f (patch) | |
| tree | 1dd7c39fb80ac968119460fd716236e6023553f1 /src/modules | |
| parent | f5eddaabf09d45adbacd4c35aa69269ba1b1cac7 (diff) | |
| download | faker-dbbc785f6a626e84fe0925504b4f267fd1a8e00f.tar.xz faker-dbbc785f6a626e84fe0925504b4f267fd1a8e00f.zip | |
refactor(helpers): deprecate unique method (#1790)
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/helpers/index.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts index 1b9b5282..a5805af8 100644 --- a/src/modules/helpers/index.ts +++ b/src/modules/helpers/index.ts @@ -1,5 +1,6 @@ import type { Faker } from '../..'; import { FakerError } from '../../errors/faker-error'; +import { deprecated } from '../../internal/deprecated'; import { luhnCheckValue } from './luhn-check'; import type { RecordKey } from './unique'; import * as uniqueExec from './unique'; @@ -1238,10 +1239,15 @@ export class HelpersModule { * @param options.compare The function used to determine whether a value was already returned. Defaults to check the existence of the key. * @param options.store The store of unique entries. Defaults to a global store. * + * @see https://github.com/faker-js/faker/issues/1785#issuecomment-1407773744 + * * @example * faker.helpers.unique(faker.person.firstName) // 'Corbin' * * @since 7.5.0 + * + * @deprecated Please find a dedicated npm package instead, or even create one on your own if you want to. + * More info can be found in issue [faker-js/faker #1785](https://github.com/faker-js/faker/issues/1785). */ unique< Method extends ( @@ -1299,6 +1305,14 @@ export class HelpersModule { store?: Record<RecordKey, RecordKey>; } = {} ): ReturnType<Method> { + deprecated({ + deprecated: 'faker.helpers.unique', + proposed: + 'https://github.com/faker-js/faker/issues/1785#issuecomment-1407773744', + since: '8.0', + until: '9.0', + }); + const { maxTime = 50, maxRetries = 50 } = options; return uniqueExec.exec(method, args, { ...options, |
