-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support: simplify to just collecting and showing URLs
- Loading branch information
1 parent
b892bf8
commit 1901d25
Showing
8 changed files
with
116 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const URL = require('url').URL | ||
|
||
// Is the value of a `support` property of a `package.json` object | ||
// a valid URL for `npm support` to display? | ||
module.exports = function (argument) { | ||
if (typeof argument !== 'string' || argument.length === 0) { | ||
return false | ||
} | ||
try { | ||
var parsed = new URL(argument) | ||
} catch (error) { | ||
return false | ||
} | ||
if ( | ||
parsed.protocol !== 'https:' && | ||
parsed.protocol !== 'http:' | ||
) return false | ||
return parsed.host | ||
} |
Oops, something went wrong.