aboutsummaryrefslogtreecommitdiff
path: root/src/modules/helpers/eval.ts
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2024-03-06 17:35:53 +0100
committerGitHub <[email protected]>2024-03-06 16:35:53 +0000
commit2716865a0441b8502c8d0ee3efbdbe1bcebe0101 (patch)
tree2b98c5b34f4dfbd4eab56e8463b9b9f5c72f428a /src/modules/helpers/eval.ts
parentade91fd30d6b5fbcc2ab2534502467b1e0f3b086 (diff)
downloadfaker-2716865a0441b8502c8d0ee3efbdbe1bcebe0101.tar.xz
faker-2716865a0441b8502c8d0ee3efbdbe1bcebe0101.zip
infra(unicorn): switch-case-braces (#2721)
Diffstat (limited to 'src/modules/helpers/eval.ts')
-rw-r--r--src/modules/helpers/eval.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/modules/helpers/eval.ts b/src/modules/helpers/eval.ts
index 033c5d35..4a861ec0 100644
--- a/src/modules/helpers/eval.ts
+++ b/src/modules/helpers/eval.ts
@@ -119,12 +119,15 @@ function evalProcessFunction(
switch (nextChar) {
case '.':
case '(':
- case undefined:
+ case undefined: {
break; // valid
- default:
+ }
+
+ default: {
throw new FakerError(
`Expected dot ('.'), open parenthesis ('('), or nothing after function call but got '${nextChar}'`
);
+ }
}
return [
@@ -223,7 +226,8 @@ function resolveProperty(entrypoint: unknown, key: string): unknown {
return entrypoint?.[key as keyof typeof entrypoint];
}
- default:
+ default: {
return undefined;
+ }
}
}