Skip to content

Commit 2915439

Browse files
authored
Merge branch 'main' into feat-random-numeric
2 parents 296ac71 + f797b63 commit 2915439

63 files changed

Lines changed: 28098 additions & 290 deletions

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ jobs:
128128
run: pnpm vitest run --coverage
129129

130130
- name: Upload coverage to Codecov
131-
uses: codecov/codecov-action@v3.0.0
131+
uses: codecov/codecov-action@v3.1.0
132132
with:
133133
token: ${{ secrets.CODECOV_TOKEN }}
134134
fail_ci_if_error: true

docs/api/localization.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ faker.locale = 'de';
5050
| ge | Georgian |
5151
| he | Hebrew |
5252
| hr | Hrvatski |
53+
| hu | Hungarian |
5354
| hy | Armenian |
5455
| id_ID | Indonesia |
5556
| it | Italian |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"conventional-changelog-cli": "~2.2.2",
102102
"cypress": "~9.5.4",
103103
"esbuild": "~0.14.38",
104-
"eslint": "~8.13.0",
104+
"eslint": "~8.14.0",
105105
"eslint-config-prettier": "~8.5.0",
106106
"eslint-define-config": "~1.4.0",
107107
"eslint-gitignore": "~0.1.0",

pnpm-lock.yaml

Lines changed: 38 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/address.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ function kilometersToMiles(miles: number): number {
3636
* @param isMetric Metric: true, Miles: false.
3737
*/
3838
function coordinateWithOffset(
39-
coordinate: [number, number],
39+
coordinate: [latitude: number, longitude: number],
4040
bearing: number,
4141
distance: number,
4242
isMetric: boolean
43-
): number[] {
43+
): [latitude: number, longitude: number] {
4444
const R = 6378.137; // Radius of the Earth (http://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html)
4545
const d = isMetric ? distance : kilometersToMiles(distance); // Distance in km
4646

@@ -492,10 +492,10 @@ export class Address {
492492
*/
493493
// TODO ST-DDT 2022-02-10: Allow coordinate parameter to be [string, string].
494494
nearbyGPSCoordinate(
495-
coordinate?: [number, number],
495+
coordinate?: [latitude: number, longitude: number],
496496
radius?: number,
497497
isMetric?: boolean
498-
): [string, string] {
498+
): [latitude: string, longitude: string] {
499499
// If there is no coordinate, the best we can do is return a random GPS coordinate.
500500
if (coordinate === undefined) {
501501
return [this.latitude(), this.longitude()];

src/git.ts

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ export class Git {
5050
*
5151
* @param options Options for the commit entry.
5252
* @param options.merge Set to `true` to generate a merge message line.
53+
* @param options.eol Choose the end of line character to use. Defaults to 'CRLF'.
54+
* 'LF' = '\n',
55+
* 'CRLF' = '\r\n'
5356
*
5457
* @example
5558
* faker.git.commitEntry()
@@ -59,17 +62,30 @@ export class Git {
5962
* //
6063
* // copy primary system
6164
*/
62-
commitEntry(options: { merge?: boolean } = {}): string {
63-
// TODO @Shinigami92 2022-01-11: We may want to make it configurable to use just `\n` instead of `\r\n`
64-
let entry = `commit ${this.commitSha()}\r\n`;
65+
commitEntry(
66+
options: {
67+
merge?: boolean;
68+
eol?: 'LF' | 'CRLF';
69+
} = {}
70+
): string {
71+
const lines = [`commit ${this.faker.git.commitSha()}`];
6572

6673
if (options.merge || this.faker.datatype.number({ min: 0, max: 4 }) === 0) {
67-
entry += `Merge: ${this.shortSha()}} ${this.shortSha()}\r\n`;
74+
lines.push(`Merge: ${this.shortSha()} ${this.shortSha()}`);
6875
}
6976

70-
entry += `Author: ${this.faker.name.firstName()} ${this.faker.name.lastName()} <${this.faker.internet.email()}>\r\n`;
71-
entry += `Date: ${this.faker.date.recent().toString()}\r\n`;
72-
entry += `\r\n\xa0\xa0\xa0\xa0${this.commitMessage()}\r\n`;
77+
lines.push(
78+
`Author: ${this.faker.name.firstName()} ${this.faker.name.lastName()} <${this.faker.internet.email()}>`,
79+
`Date: ${this.faker.date.recent().toString()}`,
80+
'',
81+
`\xa0\xa0\xa0\xa0${this.commitMessage()}`,
82+
// to end with a eol char
83+
''
84+
);
85+
86+
const eolOption = options.eol ?? 'CRLF';
87+
const eolChar = eolOption === 'CRLF' ? '\r\n' : '\n';
88+
const entry = lines.join(eolChar);
7389

7490
return entry;
7591
}

src/locale/hu.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* This file is automatically generated.
3+
* Run 'pnpm run generate:locales' to update.
4+
*/
5+
6+
import { Faker } from '../faker';
7+
import en from '../locales/en';
8+
import hu from '../locales/hu';
9+
10+
const faker = new Faker({
11+
locale: 'hu',
12+
localeFallback: 'en',
13+
locales: {
14+
hu,
15+
en,
16+
},
17+
});
18+
19+
export = faker;

0 commit comments

Comments
 (0)