File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ export function createLocaleProxy(locale: LocaleDefinition): LocaleProxy {
31
31
target : LocaleDefinition ,
32
32
categoryName : keyof LocaleDefinition
33
33
) : LocaleDefinition [ keyof LocaleDefinition ] {
34
+ if ( typeof categoryName === 'symbol' || categoryName === 'nodeType' ) {
35
+ return target [ categoryName ] ;
36
+ }
37
+
34
38
if ( categoryName in proxies ) {
35
39
return proxies [ categoryName ] ;
36
40
}
@@ -69,7 +73,9 @@ function createCategoryProxy<
69
73
entryName : keyof CategoryData
70
74
) : CategoryData [ keyof CategoryData ] {
71
75
const value = target [ entryName ] ;
72
- if ( value === null ) {
76
+ if ( typeof entryName === 'symbol' || entryName === 'nodeType' ) {
77
+ return value ;
78
+ } else if ( value === null ) {
73
79
throw new FakerError (
74
80
`The locale data for '${ categoryName } .${ entryName . toString ( ) } ' aren't applicable to this locale.
75
81
If you think this is a bug, please report it at: https://github.com/faker-js/faker`
Original file line number Diff line number Diff line change @@ -7,6 +7,16 @@ describe('LocaleProxy', () => {
7
7
const locale = createLocaleProxy ( en ) ;
8
8
const enAirline = en . airline ?? { never : 'missing' } ;
9
9
10
+ describe ( 'locale' , ( ) => {
11
+ it ( 'should be possible to use equals on locale' , ( ) => {
12
+ expect ( locale ) . toEqual ( createLocaleProxy ( en ) ) ;
13
+ } ) ;
14
+
15
+ it ( 'should be possible to use not equals on locale' , ( ) => {
16
+ expect ( locale ) . not . toEqual ( createLocaleProxy ( { } ) ) ;
17
+ } ) ;
18
+ } ) ;
19
+
10
20
describe ( 'category' , ( ) => {
11
21
it ( 'should be possible to check for a missing category' , ( ) => {
12
22
expect ( 'category' in locale ) . toBe ( true ) ;
You can’t perform that action at this time.
0 commit comments