We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents cd55e5c + 8c858b6 commit 7cf9bcbCopy full SHA for 7cf9bcb
1 file changed
functions/utilities/getTypeSafeUser.js
@@ -16,10 +16,20 @@ const validateString = (value) => {
16
return null
17
}
18
19
+const getCleanNumber = (n) => {
20
+ if (!n) return null;
21
+ const parsed = parseInt(n);
22
+ if (isNaN(parsed)) return null;
23
+ return parsed;
24
+};
25
+
26
const validateNumber = (value) => {
27
if(typeof value === 'number') {
28
return value;
29
30
+ if (typeof value === 'string') {
31
+ return getCleanNumber(value);
32
+ }
33
34
35
0 commit comments