aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2023-04-25 17:13:40 +0200
committerGitHub <[email protected]>2023-04-25 15:13:40 +0000
commit4d0458c96071917c8c3bb85fa61544caf8ff1763 (patch)
treef7c83eb2a0ffc9d1d960ce9af35c1261d8e1f08c /src
parent698fd7d909740bb9a9b7e9dfe822ef8632e3d4c6 (diff)
downloadfaker-4d0458c96071917c8c3bb85fa61544caf8ff1763.tar.xz
faker-4d0458c96071917c8c3bb85fa61544caf8ff1763.zip
fix: add support for equals on locale proxies (#2092)
Diffstat (limited to 'src')
-rw-r--r--src/locale-proxy.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/locale-proxy.ts b/src/locale-proxy.ts
index c5c6aa1b..ae5ede17 100644
--- a/src/locale-proxy.ts
+++ b/src/locale-proxy.ts
@@ -31,6 +31,10 @@ export function createLocaleProxy(locale: LocaleDefinition): LocaleProxy {
target: LocaleDefinition,
categoryName: keyof LocaleDefinition
): LocaleDefinition[keyof LocaleDefinition] {
+ if (typeof categoryName === 'symbol' || categoryName === 'nodeType') {
+ return target[categoryName];
+ }
+
if (categoryName in proxies) {
return proxies[categoryName];
}
@@ -69,7 +73,9 @@ function createCategoryProxy<
entryName: keyof CategoryData
): CategoryData[keyof CategoryData] {
const value = target[entryName];
- if (value === null) {
+ if (typeof entryName === 'symbol' || entryName === 'nodeType') {
+ return value;
+ } else if (value === null) {
throw new FakerError(
`The locale data for '${categoryName}.${entryName.toString()}' aren't applicable to this locale.
If you think this is a bug, please report it at: https://github.com/faker-js/faker`