Skip to content

Commit 4d5cf90

Browse files
fix(url.value-object): uses new logic to get valid url with URL object
1 parent 3220e48 commit 4d5cf90

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/utils/url.value-object.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ class UrlValueObject extends ValueObject<Prop> {
3030
* @returns true if value is a valid url and false if does not
3131
*/
3232
public static isValidProps(value: string): boolean {
33-
return this.validator.string(value).match(UrlValueObject.REGEX);
33+
try {
34+
new URL(value);
35+
return true;
36+
} catch (error) {
37+
return false;
38+
}
3439
}
3540

3641
validation(value: string): boolean {

0 commit comments

Comments
 (0)