faker icon indicating copy to clipboard operation
faker copied to clipboard

refactor(address.nearbyGPSCoordinate)!: return type to number tuple

Open xDivisionByZerox opened this issue 3 years ago • 6 comments
trafficstars

Discussion reference #1058.

Changes the return type of address.nearbyGPSCoordinate() from a string tuple to a number tuple.

This is a breaking change and should not be merged before the next major release.

xDivisionByZerox avatar Jun 11 '22 19:06 xDivisionByZerox

Codecov Report

Merging #1061 (2513123) into next (2c9622b) will decrease coverage by 0.00%. The diff coverage is 100.00%.

:exclamation: Current head 2513123 differs from pull request most recent head 5ab3c8b. Consider uploading reports for the commit 5ab3c8b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #1061      +/-   ##
==========================================
- Coverage   99.61%   99.60%   -0.01%     
==========================================
  Files        2166     2164       -2     
  Lines      237450   236816     -634     
  Branches     1040      999      -41     
==========================================
- Hits       236543   235888     -655     
- Misses        886      906      +20     
- Partials       21       22       +1     
Impacted Files Coverage Δ
src/modules/commerce/index.ts 100.00% <ø> (ø)
src/modules/helpers/index.ts 98.44% <ø> (-0.07%) :arrow_down:
src/modules/image/providers/lorempicsum.ts 93.85% <ø> (-1.00%) :arrow_down:
src/modules/image/providers/lorempixel.ts 91.30% <ø> (-0.65%) :arrow_down:
src/modules/image/providers/unsplash.ts 100.00% <ø> (+4.67%) :arrow_up:
src/modules/phone/index.ts 100.00% <ø> (ø)
src/faker.ts 100.00% <100.00%> (ø)
src/index.ts 100.00% <100.00%> (ø)
src/modules/address/index.ts 99.78% <100.00%> (-0.05%) :arrow_down:
src/modules/company/index.ts 100.00% <100.00%> (ø)
... and 6 more

codecov[bot] avatar Jun 11 '22 19:06 codecov[bot]

The description text should include a hint that the user might want to use toFixed on the result and some reference how much another digit is in precision. E.g. 1 degree = 100 km. 1km = 0.01degree/ToFixed(2). We dont have to use precises values but some rough estimates. I guessed these values so you should probably verify them first.

Don't know about this. That wasn't the case before either. IMO, this is on the user side, since our responsibility is the (fake) data generation not being a wiki on how specific data should be handled. If someone requests GPS coordinates I would expect them to know how to work with them.

xDivisionByZerox avatar Jun 12 '22 01:06 xDivisionByZerox

Considering the other PR, should we rather introduce a format parameter?

ST-DDT avatar Jun 13 '22 19:06 ST-DDT

Considering the other PR, should we rather introduce a format parameter?

It doesn't make sense to me that coordinates should be strings. We simply allow the input of stringified numbers due to the nature of JS. At least that's what I like to think.

xDivisionByZerox avatar Jun 13 '22 20:06 xDivisionByZerox

Cross referencing related PRs:

  • https://github.com/faker-js/faker/pull/1066
  • https://github.com/faker-js/faker/pull/1064
  • https://github.com/faker-js/faker/pull/1061

ST-DDT avatar Jun 13 '22 22:06 ST-DDT

It doesn't make sense to me that coordinates should be strings. We simply allow the input of stringified numbers due to the nature of JS. At least that's what I like to think.

Further discussion regarding that topic please in https://github.com/faker-js/faker/pull/1066 or a separate issue/discussion.

ST-DDT avatar Jun 13 '22 22:06 ST-DDT

I eagerly put the PR title to scope location as we will solve

  • #1344

in v8.0 and this will then be grouped together

Shinigami92 avatar Oct 13 '22 18:10 Shinigami92