1+ /* eslint-disable no-prototype-builtins */
12/* jshint -W097 */
23/* jshint -W030 */
34/* jshint strict: false */
@@ -14,46 +15,46 @@ const cookieTools = require('cookie');
1415let webApp ;
1516
1617function addCookies ( Cookie , headers ) {
17- if ( ! headers || ! headers [ 'set-cookie' ] ) return Cookie ;
18- const cookies = cookieTools . parse ( Cookie ) ;
19- for ( let cookie of headers [ 'set-cookie' ] ) {
20- cookie = cookie . match ( / ^ ( [ ^ = ] + ) = ( [ ^ ; ] + ) ; .* / ) ;
21- if ( cookie && cookie . length === 3 ) {
22- if ( cookie [ 1 ] === 'ap-fid' && cookie [ 2 ] === '""' ) continue ;
23- cookies [ cookie [ 1 ] ] = cookie [ 2 ] ;
18+ if ( ! headers || ! headers [ 'set-cookie' ] ) return Cookie ;
19+ const cookies = cookieTools . parse ( Cookie ) ;
20+ for ( let cookie of headers [ 'set-cookie' ] ) {
21+ cookie = cookie . match ( / ^ ( [ ^ = ] + ) = ( [ ^ ; ] + ) ; .* / ) ;
22+ if ( cookie && cookie . length === 3 ) {
23+ if ( cookie [ 1 ] === 'ap-fid' && cookie [ 2 ] === '""' ) continue ;
24+ cookies [ cookie [ 1 ] ] = cookie [ 2 ] ;
25+ }
26+ }
27+ Cookie = '' ;
28+ for ( let name in cookies ) {
29+ if ( ! cookies . hasOwnProperty ( name ) ) continue ;
30+ Cookie += name + '=' + cookies [ name ] + '; ' ;
2431 }
25- }
26- Cookie = '' ;
27- for ( let name in cookies ) {
28- if ( ! cookies . hasOwnProperty ( name ) ) continue ;
29- Cookie += name + '=' + cookies [ name ] + '; ' ;
30- }
31- Cookie = Cookie . replace ( / [ ; ] * $ / , '' ) ;
32- return Cookie ;
32+ Cookie = Cookie . replace ( / [ ; ] * $ / , '' ) ;
33+ return Cookie ;
3334}
3435
3536function customStringify ( v , func , intent ) {
36- const cache = new Map ( ) ;
37- return JSON . stringify ( v , function ( key , value ) {
38- if ( typeof value === 'object' && value !== null ) {
39- if ( cache . get ( value ) ) {
40- // Circular reference found, discard key
41- return ;
42- }
43- // Store value in our map
44- cache . set ( value , true ) ;
45- }
46- return value ;
47- } , intent ) ;
37+ const cache = new Map ( ) ;
38+ return JSON . stringify ( v , function ( key , value ) {
39+ if ( typeof value === 'object' && value !== null ) {
40+ if ( cache . get ( value ) ) {
41+ // Circular reference found, discard key
42+ return ;
43+ }
44+ // Store value in our map
45+ cache . set ( value , true ) ;
46+ }
47+ return value ;
48+ } , intent ) ;
4849}
4950
5051function initAmazonProxy ( _options , webapp , callbackCookie , callbackListening ) {
51- if ( webapp ) {
52- webApp = webapp ;
53- }
52+ if ( webapp ) {
53+ webApp = webapp ;
54+ }
5455
55- const getLocalHost = function ( noPort = false ) {
56- return `${ ( _options . proxyHost || _options . proxyOwnIp ) } ${ ( noPort || _options . useHeroku ) ? '' : `:${ _options . proxyPort } ` } ` ;
56+ const getLocalHost = function ( noPort = false ) {
57+ return `${ ( _options . proxyHost || _options . proxyOwnIp ) } ${ ( noPort || _options . useHeroku ) ? '' : `:${ _options . proxyPort } ` } ` ;
5758 } ;
5859 const initialCookies = { } ;
5960 if ( ! _options . formerRegistrationData || ! _options . formerRegistrationData . frc ) {
@@ -324,4 +325,4 @@ function initAmazonProxy(_options, webapp, callbackCookie, callbackListening) {
324325 }
325326}
326327
327- module . exports . initAmazonProxy = initAmazonProxy ;
328+ module . exports . initAmazonProxy = initAmazonProxy ;
0 commit comments