index.js 398 B

123456789101112
  1. 'use strict';
  2. const rc = require('rc');
  3. const registryUrl = scope => {
  4. const result = rc('npm', {registry: 'https://registry.npmjs.org/'});
  5. const url = result[`${scope}:registry`] || result.config_registry || result.registry;
  6. return url.slice(-1) === '/' ? url : `${url}/`;
  7. };
  8. module.exports = registryUrl;
  9. // TODO: Remove this for the next major release
  10. module.exports.default = registryUrl;