Skip to content

Commit

Permalink
fix: update typo in error message for @IsUrl decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
NoNameProvided committed Nov 20, 2022
1 parent 86993af commit 9c6e5ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/decorator/string/IsUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import ValidatorJS from 'validator';
export const IS_URL = 'isUrl';

/**
* Checks if the string is an url.
* Checks if the string is a url.
* If given value is not a string, then it returns false.
*/
export function isURL(value: string, options?: ValidatorJS.IsURLOptions): boolean {
return typeof value === 'string' && isUrlValidator(value, options);
}

/**
* Checks if the string is an url.
* Checks if the string is a url.
* If given value is not a string, then it returns false.
*/
export function IsUrl(options?: ValidatorJS.IsURLOptions, validationOptions?: ValidationOptions): PropertyDecorator {
Expand All @@ -24,7 +24,7 @@ export function IsUrl(options?: ValidatorJS.IsURLOptions, validationOptions?: Va
constraints: [options],
validator: {
validate: (value, args): boolean => isURL(value, args?.constraints[0]),
defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be an URL address', validationOptions),
defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be a URL address', validationOptions),
},
},
validationOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3437,7 +3437,7 @@ describe('IsUrl', () => {

it('should return error object with proper data', () => {
const validationType = 'isUrl';
const message = 'someProperty must be an URL address';
const message = 'someProperty must be a URL address';
return checkReturnedError(new MyClass(), invalidValues, validationType, message);
});
});
Expand Down

0 comments on commit 9c6e5ac

Please sign in to comment.