Skip to content

Commit dbbc785

Browse files
authored
refactor(helpers): deprecate unique method (#1790)
1 parent f5eddaa commit dbbc785

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/modules/helpers/index.ts

+14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Faker } from '../..';
22
import { FakerError } from '../../errors/faker-error';
3+
import { deprecated } from '../../internal/deprecated';
34
import { luhnCheckValue } from './luhn-check';
45
import type { RecordKey } from './unique';
56
import * as uniqueExec from './unique';
@@ -1238,10 +1239,15 @@ export class HelpersModule {
12381239
* @param options.compare The function used to determine whether a value was already returned. Defaults to check the existence of the key.
12391240
* @param options.store The store of unique entries. Defaults to a global store.
12401241
*
1242+
* @see https://github.com/faker-js/faker/issues/1785#issuecomment-1407773744
1243+
*
12411244
* @example
12421245
* faker.helpers.unique(faker.person.firstName) // 'Corbin'
12431246
*
12441247
* @since 7.5.0
1248+
*
1249+
* @deprecated Please find a dedicated npm package instead, or even create one on your own if you want to.
1250+
* More info can be found in issue [faker-js/faker #1785](https://github.com/faker-js/faker/issues/1785).
12451251
*/
12461252
unique<
12471253
Method extends (
@@ -1299,6 +1305,14 @@ export class HelpersModule {
12991305
store?: Record<RecordKey, RecordKey>;
13001306
} = {}
13011307
): ReturnType<Method> {
1308+
deprecated({
1309+
deprecated: 'faker.helpers.unique',
1310+
proposed:
1311+
'https://github.com/faker-js/faker/issues/1785#issuecomment-1407773744',
1312+
since: '8.0',
1313+
until: '9.0',
1314+
});
1315+
13021316
const { maxTime = 50, maxRetries = 50 } = options;
13031317
return uniqueExec.exec(method, args, {
13041318
...options,

0 commit comments

Comments
 (0)