faker
faker copied to clipboard
locale(pl): add directions and directions abbr
Codecov Report
Merging #1225 (67d11d8) into main (5585869) will increase coverage by
0.01%
. The diff coverage is100.00%
.
:exclamation: Current head 67d11d8 differs from pull request most recent head 1fefd2d. Consider uploading reports for the commit 1fefd2d to get more accurate results
@@ Coverage Diff @@
## main #1225 +/- ##
==========================================
+ Coverage 99.62% 99.63% +0.01%
==========================================
Files 2154 2156 +2
Lines 239914 239940 +26
Branches 1003 1008 +5
==========================================
+ Hits 239015 239066 +51
+ Misses 878 853 -25
Partials 21 21
Impacted Files | Coverage Δ | |
---|---|---|
src/locales/pl/address/direction.ts | 100.00% <100.00%> (ø) |
|
src/locales/pl/address/direction_abbr.ts | 100.00% <100.00%> (ø) |
|
src/locales/pl/address/index.ts | 100.00% <100.00%> (ø) |
|
src/modules/internet/user-agent.ts | 88.35% <0.00%> (+6.61%) |
:arrow_up: |
Wow! I would never expect this and it's really hard to catch on the review. It would be way better if TS could catch it automatically...
Should we change the definition to look more like:
interface Directions {
cardinal: string[]
ordinal: string[] // or intercardinal ?
secondaryIntercardinal?: string[]
}
type DirectionType = keyof Directions
And then both directions
and directions_abbr
should use this type?
Additionally, I think it makes sense to simplify the usage and change direction
signature to:
direction ({ abbr: boolean, type: DirectionType, types: DirectionType[]})
// @examples
faker.address.direction() // 'north'
faker.address.direction({ abbr: true }) // 'N'
faker.address.direction({ type: 'ordinal' }) // 'north west'
faker.address.direction({ abbr: true, type: 'ordinal' }) // 'NW'
faker.address.direction({ abbr: true, types: ['ordinal', 'secondaryIntercardinal'] }) // 'NNW'
And then deprecate the other methods? We might also skip secondaryIntercardinal
...
@pkuczynski Please create a separate issue for that.
@pkuczynski Please create a separate issue for that.
Sure! https://github.com/faker-js/faker/issues/1228
@hankucz Could you please restore the original order? (N,E,S,W, NE, SE, SW, NW) That way we can merge this and can easily automatically transform it once we change the implementation.
@ST-DDT original order restored