/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
deps/npm/node_modules/pacote/lib/util/add-git-sha.js
18 строк
602 B
npm CLI robot
deps: upgrade npm to 11.17.0
13 июн 2026, 22:08
Не верифицирован
13 июн 2026, 22:08
36bcfa7
Код
Авторство
О чём код?
// add a sha to a git remote url spec const addGitSha = (spec, sha) => { if (spec.hosted) { const h = spec.hosted const opt = { noCommittish: true } const base = h.https && h.auth ? h.https(opt) : h.shortcut(opt) return `${base}#${sha}` } else { // don't use new URL for this, because it doesn't handle scp urls // strip the committish with indexOf/slice to avoid a regexp redos const hashIndex = spec.rawSpec.indexOf('#') const base = hashIndex === -1 ? spec.rawSpec : spec.rawSpec.slice(0, hashIndex) return `${base}#${sha}` } } module.exports = addGitSha