@@ -81,6 +81,7 @@ module.exports = function (string, options, into, maxLength) {
8181
8282 if ( into ) notDetached ( into . buffer ) ;
8383
84+ var stringLength = string . length ;
8485 var bytes = into || [ ] ;
8586 var written = 0 ;
8687 var read = 0 ;
@@ -89,7 +90,7 @@ module.exports = function (string, options, into, maxLength) {
8990
9091 if ( maxLength ) while ( true ) {
9192 index = skipAsciiWhitespace ( string , index ) ;
92- if ( index === string . length ) {
93+ if ( index === stringLength ) {
9394 if ( chunk . length > 0 ) {
9495 if ( lastChunkHandling === 'stop-before-partial' ) {
9596 break ;
@@ -103,7 +104,7 @@ module.exports = function (string, options, into, maxLength) {
103104 throw new SyntaxError ( 'Missing padding' ) ;
104105 }
105106 }
106- read = string . length ;
107+ read = stringLength ;
107108 break ;
108109 }
109110 var chr = at ( string , index ) ;
@@ -114,7 +115,7 @@ module.exports = function (string, options, into, maxLength) {
114115 }
115116 index = skipAsciiWhitespace ( string , index ) ;
116117 if ( chunk . length === 2 ) {
117- if ( index === string . length ) {
118+ if ( index === stringLength ) {
118119 if ( lastChunkHandling === 'stop-before-partial' ) {
119120 break ;
120121 }
@@ -125,11 +126,11 @@ module.exports = function (string, options, into, maxLength) {
125126 index = skipAsciiWhitespace ( string , index ) ;
126127 }
127128 }
128- if ( index < string . length ) {
129+ if ( index < stringLength ) {
129130 throw new SyntaxError ( 'Unexpected character after padding' ) ;
130131 }
131132 written = writeBytes ( bytes , decodeBase64Chunk ( chunk , alphabet , lastChunkHandling === 'strict' ) , written ) ;
132- read = string . length ;
133+ read = stringLength ;
133134 break ;
134135 }
135136 if ( ! hasOwn ( alphabet , chr ) ) {
0 commit comments