diff options
| author | Matt Mayer <[email protected]> | 2024-02-28 02:41:48 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-02-27 20:41:48 +0100 |
| commit | 0d4cba637cdd38e7757ecca1b7eae75d7a737fa8 (patch) | |
| tree | 27983120b5d0d1d940b6dc273e0faebee76ff74d /src/modules | |
| parent | 682a4276f13d7b8f48e1bd8aafcf011c7bd10390 (diff) | |
| download | faker-0d4cba637cdd38e7757ecca1b7eae75d7a737fa8.tar.xz faker-0d4cba637cdd38e7757ecca1b7eae75d7a737fa8.zip | |
refactor(person)!: flatten jobs definitions (#2505)
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/person/index.ts | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/src/modules/person/index.ts b/src/modules/person/index.ts index 6c5a42df..dce8a45f 100644 --- a/src/modules/person/index.ts +++ b/src/modules/person/index.ts @@ -1,5 +1,4 @@ import type { Faker } from '../..'; -import { FakerError } from '../../errors/faker-error'; import { ModuleBase } from '../../internal/module-base'; import { assertLocaleData } from '../../locale-proxy'; @@ -388,13 +387,9 @@ export class PersonModule extends ModuleBase { * @since 8.0.0 */ jobDescriptor(): string { - const values = this.faker.definitions.person.title.descriptor; - - if (values == null) { - throw new FakerError('No person.title.descriptor definitions available.'); - } - - return this.faker.helpers.arrayElement(values); + return this.faker.helpers.arrayElement( + this.faker.definitions.person.job_descriptor + ); } /** @@ -406,13 +401,9 @@ export class PersonModule extends ModuleBase { * @since 8.0.0 */ jobArea(): string { - const values = this.faker.definitions.person.title.level; - - if (values == null) { - throw new FakerError('No person.title.area definitions available.'); - } - - return this.faker.helpers.arrayElement(values); + return this.faker.helpers.arrayElement( + this.faker.definitions.person.job_area + ); } /** @@ -424,13 +415,9 @@ export class PersonModule extends ModuleBase { * @since 8.0.0 */ jobType(): string { - const values = this.faker.definitions.person.title.job; - - if (values == null) { - throw new FakerError('No person.title.job definitions available.'); - } - - return this.faker.helpers.arrayElement(values); + return this.faker.helpers.arrayElement( + this.faker.definitions.person.job_type + ); } /** |
