diff options
| author | Shinigami <[email protected]> | 2022-10-15 03:29:21 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-10-14 21:29:21 +0200 |
| commit | 9c1437d6034ef5537c079746761c4c71347f768b (patch) | |
| tree | 0a20ebb6b8e2501f15208600b58e5bfc587bbff3 /src/modules/random | |
| parent | 1ab33c5caf323d25bd21b3b3afaf8af3686207b4 (diff) | |
| download | faker-9c1437d6034ef5537c079746761c4c71347f768b.tar.xz faker-9c1437d6034ef5537c079746761c4c71347f768b.zip | |
refactor!: cleanup deprecations (#1440)
Diffstat (limited to 'src/modules/random')
| -rw-r--r-- | src/modules/random/index.ts | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/src/modules/random/index.ts b/src/modules/random/index.ts index b4034343..7ce4df75 100644 --- a/src/modules/random/index.ts +++ b/src/modules/random/index.ts @@ -1,6 +1,5 @@ import type { Faker } from '../..'; import { FakerError } from '../../errors/faker-error'; -import { deprecated } from '../../internal/deprecated'; import type { LiteralUnion } from '../../utils/types'; export type Casing = 'upper' | 'lower' | 'mixed'; @@ -263,10 +262,9 @@ export class RandomModule { /** * Generating a string consisting of letters in the English alphabet. * - * @param options Either the number of characters or an options instance. Defaults to `{ count: 1, casing: 'lower', bannedChars: [] }`. + * @param options Either the number of characters or an options instance. Defaults to `{ count: 1, casing: 'mixed', bannedChars: [] }`. * @param options.count The number of characters to generate. Defaults to `1`. - * @param options.casing The casing of the characters. Defaults to `'lower'`. - * @param options.upcase Deprecated, use `casing: 'upper'` instead. + * @param options.casing The casing of the characters. Defaults to `'mixed'`. * @param options.bannedChars An array with characters to exclude. Defaults to `[]`. * * @example @@ -281,10 +279,6 @@ export class RandomModule { | number | { count?: number; - /** - * @deprecated Use `casing` instead. - */ - upcase?: boolean; casing?: Casing; bannedChars?: readonly LiteralUnion<AlphaChar>[] | string; } = {} @@ -295,7 +289,7 @@ export class RandomModule { }; } - const { count = 1, upcase } = options; + const { count = 1 } = options; let { bannedChars = [] } = options; if (typeof bannedChars === 'string') { @@ -306,19 +300,7 @@ export class RandomModule { return ''; } - const { - // Switch to 'mixed' with v8.0 - casing = upcase ? 'upper' : 'lower', - } = options; - - if (upcase != null) { - deprecated({ - deprecated: 'faker.random.alpha({ upcase: true })', - proposed: "faker.random.alpha({ casing: 'upper' })", - since: '7.0', - until: '8.0', - }); - } + const { casing = 'mixed' } = options; let charsArray: string[]; switch (casing) { |
