You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Validates if a string represents a numeric value (integer or decimal).
869
+
870
+
```javascript
871
+
isNumeric("42"); // true
872
+
isNumeric("-17"); // true
873
+
isNumeric("3.14"); // true
874
+
isNumeric("-0.5"); // true
875
+
isNumeric(" 42 "); // true (whitespace trimmed)
876
+
isNumeric("abc"); // false
877
+
isNumeric(""); // false
878
+
isNumeric("Infinity"); // false
879
+
isNumeric("1e5"); // false (scientific notation not supported)
880
+
```
881
+
882
+
#### `isAlphanumeric(str: string): boolean`
883
+
884
+
Validates if a string contains only alphanumeric characters (a-z, A-Z, 0-9). Useful for validating usernames, identifiers, and other inputs that should not contain special characters or whitespace.
885
+
886
+
```javascript
887
+
isAlphanumeric("user123"); // true
888
+
isAlphanumeric("HelloWorld"); // true
889
+
isAlphanumeric("ABC123XYZ"); // true
890
+
isAlphanumeric("test"); // true
891
+
isAlphanumeric("123"); // true
892
+
isAlphanumeric("hello_world"); // false (underscore not allowed)
893
+
isAlphanumeric("hello world"); // false (whitespace not allowed)
894
+
isAlphanumeric("test-123"); // false (hyphen not allowed)
895
+
isAlphanumeric("café"); // false (Unicode not allowed)
896
+
isAlphanumeric(""); // false (empty string)
897
+
```
898
+
899
+
#### `isUUID(str: string): boolean`
900
+
901
+
Validates if a string is a valid UUID (Universally Unique Identifier) in the standard 8-4-4-4-12 format. Accepts all UUID versions (v1-v5), the NIL UUID, and is case-insensitive. Perfect for validating API identifiers, session tokens, and database IDs.
0 commit comments