Skip to content

Commit

Permalink
The value must be a string
Browse files Browse the repository at this point in the history
  • Loading branch information
lqzhgood authored Feb 7, 2019
1 parent b758887 commit 6bcbf19
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/clean-host.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,16 @@ function checkLowerCaseNeeded(value) {


module.exports = function extractHostname(value) {
if (!value || typeof value !== 'string') {
return null;
}
// First check if `value` is already a valid hostname.
if (isValid(value)) {
return trimTrailingDots(value);
}

var url = value;

if (typeof url !== 'string') {
url = '' + url;
}

var needsTrimming = checkTrimmingNeeded(url);
if (needsTrimming) {
url = url.trim();
Expand Down

0 comments on commit 6bcbf19

Please sign in to comment.