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.
1 parent 4624a24 commit 999da76Copy full SHA for 999da76
packages/common/utils/assert-string.ts
packages/common/utils/is-uuid.ts
@@ -1,4 +1,4 @@
1
-import { assertString } from './assert-string';
+import { BadRequestException } from '../exceptions';
2
3
const uuid = {
4
3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
@@ -8,7 +8,9 @@ const uuid = {
8
};
9
10
export function isUUID(str: any, version = 'all') {
11
- assertString(str);
+ if (typeof str !== 'string') {
12
+ throw new BadRequestException('The value passed as UUID is not a string');
13
+ }
14
const pattern = uuid[version];
15
return pattern && pattern.test(str);
16
}
0 commit comments