Skip to content

Commit

Permalink
fix issue when parameters are empty or the first arg is not an string,
Browse files Browse the repository at this point in the history
…closes #49
  • Loading branch information
jfromaniello committed Jul 5, 2019
1 parent 4ab20d6 commit 68f782c
Show file tree
Hide file tree
Showing 3 changed files with 1,455 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/url-join.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

function normalize (strArray) {
var resultArray = [];
if (strArray.length === 0) { return ''; }

if (typeof strArray[0] !== 'string') {
throw new TypeError('Url must be a string. Received ' + strArray[0]);
}

// If the first part is a plain protocol, we combine it with the next part.
if (strArray[0].match(/^[^/:]+:\/*$/) && strArray.length > 1) {
Expand Down
Loading

0 comments on commit 68f782c

Please sign in to comment.