var assign = Object.assign || require('object-assign')
var Promise = Promise || require('promise')
var denodeify = require('es6-denodeify')(Promise)
var tough = require('tough-cookie')

module.exports = function fetchCookieDecorator (fetch, jar) {
  fetch = fetch || window.fetch
  jar = jar || new tough.CookieJar()

  var getCookieString = denodeify(jar.getCookieString.bind(jar))
  var setCookie = denodeify(jar.setCookie.bind(jar))

  return function fetchCookie (url, opts) {
    opts = opts || {}

    return getCookieString(url)
      .then(function (cookie) {
        return fetch(url, assign(opts, {
          headers: assign(opts.headers || {}, { cookie: cookie })
        }))
      })
      .then(function (res) {
        var cookies = res.headers.getAll('set-cookie')

        if (!cookies.length) {
          return res
        }

        return Promise.all(cookies.map(cookie => setCookie(cookie, url)))
          .then(function () {
            return res
          })
      })
  }
}

@@ -880,17 +880,42 @@
 map(
-cookie =%3E
+function(cookie)%7B%0A          return
  set
@@ -932,15 +932,13 @@
 kie,
- 
 url)
-))
+;
 %0A   
@@ -938,26 +938,27 @@
 l);%0A        
-  
+%7D))
 .then(functi
@@ -967,34 +967,32 @@
  () %7B%0A          
- 
- 
 return res%0A     
@@ -990,28 +990,27 @@
 res%0A        
-  
 %7D)
+;
 %0A      %7D)%0A  
@@ -1006,15 +1006,16 @@
       %7D)
+;
 %0A  %7D%0A%7D%0A

Replace arrow notation with es5 standard function mapping to allow for wider compatibility;