-
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 b8d1613
Showing
6 changed files
with
111 additions
and
299 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 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 | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.