@@ -236,7 +236,7 @@ function deserializeObject(
236236 if ( i >= buffer . byteLength ) throw new BSONError ( 'Bad BSON Document: illegal CString' ) ;
237237
238238 // Represents the key
239- const name = isArray ? arrayIndex ++ : ByteUtils . toUTF8 ( buffer . subarray ( index , i ) ) ;
239+ const name = isArray ? arrayIndex ++ : ByteUtils . toUTF8 ( buffer , index , i ) ;
240240
241241 // shouldValidateKey is true if the key should be validated, false otherwise
242242 let shouldValidateKey = true ;
@@ -476,7 +476,7 @@ function deserializeObject(
476476 // If are at the end of the buffer there is a problem with the document
477477 if ( i >= buffer . length ) throw new BSONError ( 'Bad BSON Document: illegal CString' ) ;
478478 // Return the C string
479- const source = ByteUtils . toUTF8 ( buffer . subarray ( index , i ) ) ;
479+ const source = ByteUtils . toUTF8 ( buffer , index , i ) ;
480480 // Create the regexp
481481 index = i + 1 ;
482482
@@ -489,7 +489,7 @@ function deserializeObject(
489489 // If are at the end of the buffer there is a problem with the document
490490 if ( i >= buffer . length ) throw new BSONError ( 'Bad BSON Document: illegal CString' ) ;
491491 // Return the C string
492- const regExpOptions = ByteUtils . toUTF8 ( buffer . subarray ( index , i ) ) ;
492+ const regExpOptions = ByteUtils . toUTF8 ( buffer , index , i ) ;
493493 index = i + 1 ;
494494
495495 // For each option add the corresponding one for javascript
@@ -521,7 +521,7 @@ function deserializeObject(
521521 // If are at the end of the buffer there is a problem with the document
522522 if ( i >= buffer . length ) throw new BSONError ( 'Bad BSON Document: illegal CString' ) ;
523523 // Return the C string
524- const source = ByteUtils . toUTF8 ( buffer . subarray ( index , i ) ) ;
524+ const source = ByteUtils . toUTF8 ( buffer , index , i ) ;
525525 index = i + 1 ;
526526
527527 // Get the start search index
@@ -533,7 +533,7 @@ function deserializeObject(
533533 // If are at the end of the buffer there is a problem with the document
534534 if ( i >= buffer . length ) throw new BSONError ( 'Bad BSON Document: illegal CString' ) ;
535535 // Return the C string
536- const regExpOptions = ByteUtils . toUTF8 ( buffer . subarray ( index , i ) ) ;
536+ const regExpOptions = ByteUtils . toUTF8 ( buffer , index , i ) ;
537537 index = i + 1 ;
538538
539539 // Set the object
@@ -678,7 +678,7 @@ function deserializeObject(
678678 throw new BSONError ( 'Invalid UTF-8 string in BSON document' ) ;
679679 }
680680 }
681- const namespace = ByteUtils . toUTF8 ( buffer . subarray ( index , index + stringSize - 1 ) ) ;
681+ const namespace = ByteUtils . toUTF8 ( buffer , index , index + stringSize - 1 ) ;
682682 // Update parse index position
683683 index = index + stringSize ;
684684
@@ -735,7 +735,7 @@ function getValidatedString(
735735 end : number ,
736736 shouldValidateUtf8 : boolean
737737) {
738- const value = ByteUtils . toUTF8 ( buffer . subarray ( start , end ) ) ;
738+ const value = ByteUtils . toUTF8 ( buffer , start , end ) ;
739739 // if utf8 validation is on, do the check
740740 if ( shouldValidateUtf8 ) {
741741 for ( let i = 0 ; i < value . length ; i ++ ) {
0 commit comments