'use strict'vartough=require('tough-cookie')varCookie=tough.CookievarCookieJar=tough.CookieJarexports.parse=function(str){if(str&&str.uri){str=str.uri}if(typeofstr!=='string'){thrownewError('The cookie function only accepts STRING as param')}returnCookie.parse(str,{loose:true})}// Adapt the sometimes-Async api of tough.CookieJar to our requirementsfunctionRequestJar(store){varself=thisself._jar=newCookieJar(store,{looseMode:true})}RequestJar.prototype.setCookie=function(cookieOrStr,uri,options){varself=thisreturnself._jar.setCookieSync(cookieOrStr,uri,options||{})}RequestJar.prototype.getCookieString=function(uri){varself=thisreturnself._jar.getCookieStringSync(uri)}RequestJar.prototype.getCookies=function(uri){varself=thisreturnself._jar.getCookiesSync(uri)}exports.jar=function(store){returnnewRequestJar(store)}