sherry-utils
Version:
sherry-utils for Sherry
18 lines (14 loc) • 433 B
JavaScript
const HTTP_RE = /^https?:\/\//
const SSH_RE = /^git@([^:]*):(.*)\.git/
function isHttpRepoUrl(v) {
return HTTP_RE.test(v)
}
function isSshRepoUrl(v) {
return SSH_RE.test(v)
}
module.exports = v => isHttpRepoUrl(v) || isSshRepoUrl(v)
module.exports.isHttpRepoUrl = isHttpRepoUrl
module.exports.isSshRepoUrl = isSshRepoUrl
module.exports.removePrefix = v => isHttpRepoUrl(v)
? v.replace(HTTP_RE, '')
: v.replace(SSH_RE, '')