fetch-config.js 559 B

123456789101112131415161718192021222324252627
  1. "use strict";
  2. const log = require("npmlog");
  3. module.exports.getFetchConfig = getFetchConfig;
  4. /**
  5. * Create a merged options object suitable for npm-registry-fetch.
  6. * @param {{ [key: string]: unknown }} options
  7. * @param {Partial<FetchConfig>} [extra]
  8. * @returns {FetchConfig}
  9. */
  10. function getFetchConfig(options, extra) {
  11. return {
  12. log,
  13. ...options,
  14. ...extra,
  15. };
  16. }
  17. /**
  18. * @typedef {object} FetchConfig
  19. * @property {number} [fetchRetries]
  20. * @property {typeof log} log
  21. * @property {string} [registry]
  22. * @property {string} [username]
  23. */