Skip to content

Commit 3345244

Browse files
committed
chore: wip
1 parent bcb4dbc commit 3345244

File tree

65 files changed

+200
-178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+200
-178
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ jobs:
107107
run: bun run build
108108

109109
- name: Publish Commit
110-
run: bunx pkg-pr-new publish
110+
run: bunx pkg-pr-new publish './packages/*'

packages/af-za/src/af_ZA.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { LocaleDefinition } from 'nanofaker'
1+
import type { DeepPartial, LocaleDefinition } from 'nanofaker'
22

3-
export const af_ZA: Partial<LocaleDefinition> = {
3+
export const af_ZA: DeepPartial<LocaleDefinition> = {
44
title: 'Afrikaans (South Africa)',
55

66
address: {

packages/benchmarks/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { randCity, randCompanyName, randCountry, randEmail, randFullName, randPh
44
import casual from 'casual'
55
import Chance from 'chance'
66
import { Bench } from 'tinybench'
7-
// eslint-disable-next-line antfu/no-import-dist
7+
// @ts-expect-error nanofaker is typed
88
import { faker as nanofaker } from '../../core/dist/src/index.js'
99

1010
const chance = new Chance()

packages/core/src/en.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { LocaleDefinition } from '../types'
1+
import type { LocaleDefinition } from './types'
22

33
export const en: LocaleDefinition = {
44
title: 'English',

packages/core/src/modules/address.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class AddressModule {
2222
* @example faker.address.streetSuffix() // 'Street'
2323
*/
2424
streetSuffix(): string {
25-
return this.random.arrayElement(this.locale.address.streetSuffix)
25+
return this.random.arrayElement(this.locale.address.streetSuffix ?? ['Street', 'Avenue', 'Road', 'Boulevard', 'Drive', 'Lane', 'Way'])
2626
}
2727

2828
/**
@@ -45,7 +45,7 @@ export class AddressModule {
4545
* @example faker.address.buildingNumber() // '123'
4646
*/
4747
buildingNumber(): string {
48-
const format = this.random.arrayElement(this.locale.address.buildingNumber)
48+
const format = this.random.arrayElement(this.locale.address.buildingNumber ?? ["#", "##", "###"])
4949
return this.random.replaceSymbols(format)
5050
}
5151

@@ -70,7 +70,7 @@ export class AddressModule {
7070
* @example faker.address.stateAbbr() // 'CA'
7171
*/
7272
stateAbbr(): string {
73-
return this.random.arrayElement(this.locale.address.stateAbbr)
73+
return this.random.arrayElement(this.locale.address.stateAbbr ?? [])
7474
}
7575

7676
/**
@@ -86,7 +86,7 @@ export class AddressModule {
8686
* @example faker.address.countryCode() // 'US'
8787
*/
8888
countryCode(): string {
89-
return this.random.arrayElement(this.locale.address.countryCode)
89+
return this.random.arrayElement(this.locale.address.countryCode ?? [])
9090
}
9191

9292
/**
@@ -103,7 +103,7 @@ export class AddressModule {
103103
* @example faker.address.direction() // 'North'
104104
*/
105105
direction(): string {
106-
return this.random.arrayElement(this.locale.address.direction)
106+
return this.random.arrayElement(this.locale.address.direction ?? ["North", "South", "East", "West"])
107107
}
108108

109109
/**

packages/core/src/modules/animal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { LocaleDefinition } from '../types'
44
export class AnimalModule {
55
constructor(
66
private random: Random,
7-
private locale?: LocaleDefinition,
7+
private locale?: LocaleDefinition | undefined,
88
) {}
99

1010
/**

packages/core/src/modules/book.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { LocaleDefinition } from '../types'
44
export class BookModule {
55
constructor(
66
private random: Random,
7-
private locale?: LocaleDefinition,
7+
private locale?: LocaleDefinition | undefined,
88
) {}
99

1010
/**

packages/core/src/modules/color.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { ColorOptions, LocaleDefinition } from '../types'
44
export class ColorModule {
55
constructor(
66
private random: Random,
7-
private locale?: LocaleDefinition,
7+
private locale?: LocaleDefinition | undefined,
88
) {}
99

1010
/**

packages/core/src/modules/commerce.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { LocaleDefinition } from '../types'
44
export class CommerceModule {
55
constructor(
66
private random: Random,
7-
private locale?: LocaleDefinition,
7+
private locale?: LocaleDefinition | undefined,
88
) {}
99

1010
/**

packages/core/src/modules/company.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export class CompanyModule {
1212
* @example faker.company.name() // 'TechCorp Inc'
1313
*/
1414
name(): string {
15-
const name = this.random.arrayElement(this.locale.company.name)
16-
const suffix = this.random.arrayElement(this.locale.company.suffix)
15+
const name = this.random.arrayElement(this.locale.company.name ?? ["Company"])
16+
const suffix = this.random.arrayElement(this.locale.company.suffix ?? ["Inc", "LLC", "Corp"])
1717
return `${name} ${suffix}`
1818
}
1919

@@ -22,25 +22,25 @@ export class CompanyModule {
2222
* @example faker.company.suffix() // 'Inc'
2323
*/
2424
suffix(): string {
25-
return this.random.arrayElement(this.locale.company.suffix)
25+
return this.random.arrayElement(this.locale.company.suffix ?? ["Inc", "LLC", "Corp"])
2626
}
2727

2828
/**
2929
* Generate a random industry
3030
* @example faker.company.industry() // 'Technology'
3131
*/
3232
industry(): string {
33-
return this.random.arrayElement(this.locale.company.industry)
33+
return this.random.arrayElement(this.locale.company.industry ?? ["Technology"])
3434
}
3535

3636
/**
3737
* Generate a random company catchphrase
3838
* @example faker.company.catchphrase() // 'Innovative cloud-based solutions'
3939
*/
4040
catchphrase(): string {
41-
const adjective = this.random.arrayElement(this.locale.company.adjective)
42-
const descriptor = this.random.arrayElement(this.locale.company.descriptor)
43-
const noun = this.random.arrayElement(this.locale.company.noun)
41+
const adjective = this.random.arrayElement(this.locale.company.adjective ?? ["innovative"])
42+
const descriptor = this.random.arrayElement(this.locale.company.descriptor ?? ["digital"])
43+
const noun = this.random.arrayElement(this.locale.company.noun ?? ["solution"])
4444
return `${adjective} ${descriptor} ${noun}`
4545
}
4646

@@ -49,7 +49,7 @@ export class CompanyModule {
4949
* @example faker.company.buzzword() // 'synergize'
5050
*/
5151
buzzword(): string {
52-
return this.random.arrayElement(this.locale.company.buzzwords)
52+
return this.random.arrayElement(this.locale.company.buzzwords ?? ["innovation"])
5353
}
5454

5555
/**
@@ -58,8 +58,8 @@ export class CompanyModule {
5858
*/
5959
bs(): string {
6060
const buzzword = this.buzzword()
61-
const descriptor = this.random.arrayElement(this.locale.company.descriptor)
62-
const noun = this.random.arrayElement(this.locale.company.noun)
61+
const descriptor = this.random.arrayElement(this.locale.company.descriptor ?? ["digital"])
62+
const noun = this.random.arrayElement(this.locale.company.noun ?? ["solution"])
6363
return `${buzzword} ${descriptor} ${noun}`
6464
}
6565
}

0 commit comments

Comments
 (0)