Skip to content

Commit

Permalink
Merge branch 'main' into feat-random-numeric
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 authored Apr 24, 2022
2 parents 296ac71 + f797b63 commit 2915439
Show file tree
Hide file tree
Showing 63 changed files with 28,098 additions and 290 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
run: pnpm vitest run --coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.0.0
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
1 change: 1 addition & 0 deletions docs/api/localization.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ faker.locale = 'de';
| ge | Georgian |
| he | Hebrew |
| hr | Hrvatski |
| hu | Hungarian |
| hy | Armenian |
| id_ID | Indonesia |
| it | Italian |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"conventional-changelog-cli": "~2.2.2",
"cypress": "~9.5.4",
"esbuild": "~0.14.38",
"eslint": "~8.13.0",
"eslint": "~8.14.0",
"eslint-config-prettier": "~8.5.0",
"eslint-define-config": "~1.4.0",
"eslint-gitignore": "~0.1.0",
Expand Down
76 changes: 38 additions & 38 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ function kilometersToMiles(miles: number): number {
* @param isMetric Metric: true, Miles: false.
*/
function coordinateWithOffset(
coordinate: [number, number],
coordinate: [latitude: number, longitude: number],
bearing: number,
distance: number,
isMetric: boolean
): number[] {
): [latitude: number, longitude: number] {
const R = 6378.137; // Radius of the Earth (http://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html)
const d = isMetric ? distance : kilometersToMiles(distance); // Distance in km

Expand Down Expand Up @@ -492,10 +492,10 @@ export class Address {
*/
// TODO ST-DDT 2022-02-10: Allow coordinate parameter to be [string, string].
nearbyGPSCoordinate(
coordinate?: [number, number],
coordinate?: [latitude: number, longitude: number],
radius?: number,
isMetric?: boolean
): [string, string] {
): [latitude: string, longitude: string] {
// If there is no coordinate, the best we can do is return a random GPS coordinate.
if (coordinate === undefined) {
return [this.latitude(), this.longitude()];
Expand Down
30 changes: 23 additions & 7 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export class Git {
*
* @param options Options for the commit entry.
* @param options.merge Set to `true` to generate a merge message line.
* @param options.eol Choose the end of line character to use. Defaults to 'CRLF'.
* 'LF' = '\n',
* 'CRLF' = '\r\n'
*
* @example
* faker.git.commitEntry()
Expand All @@ -59,17 +62,30 @@ export class Git {
* //
* // copy primary system
*/
commitEntry(options: { merge?: boolean } = {}): string {
// TODO @Shinigami92 2022-01-11: We may want to make it configurable to use just `\n` instead of `\r\n`
let entry = `commit ${this.commitSha()}\r\n`;
commitEntry(
options: {
merge?: boolean;
eol?: 'LF' | 'CRLF';
} = {}
): string {
const lines = [`commit ${this.faker.git.commitSha()}`];

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

entry += `Author: ${this.faker.name.firstName()} ${this.faker.name.lastName()} <${this.faker.internet.email()}>\r\n`;
entry += `Date: ${this.faker.date.recent().toString()}\r\n`;
entry += `\r\n\xa0\xa0\xa0\xa0${this.commitMessage()}\r\n`;
lines.push(
`Author: ${this.faker.name.firstName()} ${this.faker.name.lastName()} <${this.faker.internet.email()}>`,
`Date: ${this.faker.date.recent().toString()}`,
'',
`\xa0\xa0\xa0\xa0${this.commitMessage()}`,
// to end with a eol char
''
);

const eolOption = options.eol ?? 'CRLF';
const eolChar = eolOption === 'CRLF' ? '\r\n' : '\n';
const entry = lines.join(eolChar);

return entry;
}
Expand Down
19 changes: 19 additions & 0 deletions src/locale/hu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* This file is automatically generated.
* Run 'pnpm run generate:locales' to update.
*/

import { Faker } from '../faker';
import en from '../locales/en';
import hu from '../locales/hu';

const faker = new Faker({
locale: 'hu',
localeFallback: 'en',
locales: {
hu,
en,
},
});

export = faker;
Loading

0 comments on commit 2915439

Please sign in to comment.