Skip to content

Commit

Permalink
fix(common): ParseUUIDPipe - use isString() util function
Browse files Browse the repository at this point in the history
  • Loading branch information
titivuk committed Dec 29, 2021
1 parent 7cc8106 commit 9c0cdd2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/common/pipes/parse-uuid.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
ErrorHttpStatusCode,
HttpErrorByCode,
} from '../utils/http-error-by-code.util';
import { isString } from '../utils/shared.utils';

export interface ParseUUIDPipeOptions {
version?: '3' | '4' | '5';
Expand Down Expand Up @@ -53,7 +54,7 @@ export class ParseUUIDPipe implements PipeTransform<string> {
}

protected isUUID(str: unknown, version = 'all') {
if (typeof str !== 'string') {
if (!isString(str)) {
throw this.exceptionFactory('The value passed as UUID is not a string');
}
const pattern = ParseUUIDPipe.uuidRegExps[version];
Expand Down

0 comments on commit 9c0cdd2

Please sign in to comment.