hunk.code_window:  *     resolveTarball(pkg)
    */
   module.exports = function resolveTarball (pkg) {
     const name = getTarballName(pkg.raw)
     return Promise.resolve({
       name,
  
hunk.labels: keep keep keep keep replace keep keep keep
hunk.after_edit:   const name = getTarballName(pkg.rawSpec)
  
hunk.file_path: lib/resolve/tarball.js
hunk.type: replace
file: 'use strict'
  const retry = require('retry')
  const isRetryAllowed = require('is-retry-allowed')
  
  module.exports = opts => fn => function () {
    const operation = retry.operation(opts)
  
    return new Promise((resolve, reject) => {
      operation.attempt(() => {
        fn.apply(null, arguments)
          .then(resolve)
          .catch(err => {
            if (enhancedRetryAllowed(err) && operation.retry(err)) {
              return
            }
            reject(operation.mainError() || err)
          })
      })
    })
  }
  
  function enhancedRetryAllowed (err) {
    if (err.statusCode) {
      return isRetryAllowedForStatusCode(err.statusCode)
    }
    return isRetryAllowed(err)
  }
  
  function isRetryAllowedForStatusCode (sc) {
    return sc === 408 || sc >= 500
  }
  