summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/pacote/lib/fetchers/registry/pick-registry.js
blob: f326950da42d8d56df4be60ffd5a5d7284e4fb7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict'

module.exports = pickRegistry
function pickRegistry (spec, opts) {
  let registry = spec.scope && opts.scopeTargets[spec.scope]

  if (!registry && opts.scope) {
    const prefix = opts.scope[0] === '@' ? '' : '@'
    registry = opts.scopeTargets[prefix + opts.scope]
  }

  if (!registry) {
    registry = opts.registry
  }

  return registry
}