aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2024-02-20 12:15:52 +0100
committerGitHub <[email protected]>2024-02-20 12:15:52 +0100
commitd89b348aa6465e5b6b6521b1dc4b77a89d58cc73 (patch)
tree03c9953cb0a2608f697e097debd15409ac102070 /docs
parent25f2a0326b1103c8a47a06156d43d71d2d72b7fa (diff)
downloadfaker-d89b348aa6465e5b6b6521b1dc4b77a89d58cc73.tar.xz
faker-d89b348aa6465e5b6b6521b1dc4b77a89d58cc73.zip
infra(unicorn): no-useless-switch-case (#2508)
Diffstat (limited to 'docs')
-rw-r--r--docs/guide/upgrading_v9/2508.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/guide/upgrading_v9/2508.md b/docs/guide/upgrading_v9/2508.md
new file mode 100644
index 00000000..28e6f8ed
--- /dev/null
+++ b/docs/guide/upgrading_v9/2508.md
@@ -0,0 +1,20 @@
+# Some methods now return undefined in Javascript when unknown enumeration values are passed
+
+Some methods would previously fallback to a default value for an option when an unknown value was passed for a enum parameter.
+Now, these methods will return undefined instead.
+This only affects usage in Javascript, as in Typescript this usage would already throw a compile-time error.
+
+For example:
+
+```ts
+faker.color.rgb({ format: 'unexpectedvalue' });
+// in Faker v8, is [ 110, 82, 190 ] like {format: "decimal"}
+// in Faker v9, is undefined
+```
+
+This affects:
+
+- The `format` property of `faker.color.rgb()` must be one of `'binary' | 'css' | 'decimal' | 'hex'` if provided
+- The `format` property of `faker.color.cmyk()`, `faker.color.hsl()`, `faker.color.hwb()`, `faker.color.lab()`, `faker.color.lch()` must be one of `'binary' | 'css' | 'decimal'` if provided
+- The `variant` property of `faker.location.countryCode()` must be one of `alpha-2`, `alpha-3`, `numeric` if provided
+- The `casing` property of `faker.string.alpha()` and `faker.string.alphanumeric()` must be one of `'upper' | 'lower' | 'mixed'` if provided