@@ -236,7 +236,7 @@ function deserializeObject(
236
236
if ( i >= buffer . byteLength ) throw new BSONError ( 'Bad BSON Document: illegal CString' ) ;
237
237
238
238
// Represents the key
239
- const name = isArray ? arrayIndex ++ : ByteUtils . toUTF8 ( buffer . subarray ( index , i ) ) ;
239
+ const name = isArray ? arrayIndex ++ : ByteUtils . toUTF8 ( buffer , index , i ) ;
240
240
241
241
// shouldValidateKey is true if the key should be validated, false otherwise
242
242
let shouldValidateKey = true ;
@@ -476,7 +476,7 @@ function deserializeObject(
476
476
// If are at the end of the buffer there is a problem with the document
477
477
if ( i >= buffer . length ) throw new BSONError ( 'Bad BSON Document: illegal CString' ) ;
478
478
// Return the C string
479
- const source = ByteUtils . toUTF8 ( buffer . subarray ( index , i ) ) ;
479
+ const source = ByteUtils . toUTF8 ( buffer , index , i ) ;
480
480
// Create the regexp
481
481
index = i + 1 ;
482
482
@@ -489,7 +489,7 @@ function deserializeObject(
489
489
// If are at the end of the buffer there is a problem with the document
490
490
if ( i >= buffer . length ) throw new BSONError ( 'Bad BSON Document: illegal CString' ) ;
491
491
// Return the C string
492
- const regExpOptions = ByteUtils . toUTF8 ( buffer . subarray ( index , i ) ) ;
492
+ const regExpOptions = ByteUtils . toUTF8 ( buffer , index , i ) ;
493
493
index = i + 1 ;
494
494
495
495
// For each option add the corresponding one for javascript
@@ -521,7 +521,7 @@ function deserializeObject(
521
521
// If are at the end of the buffer there is a problem with the document
522
522
if ( i >= buffer . length ) throw new BSONError ( 'Bad BSON Document: illegal CString' ) ;
523
523
// Return the C string
524
- const source = ByteUtils . toUTF8 ( buffer . subarray ( index , i ) ) ;
524
+ const source = ByteUtils . toUTF8 ( buffer , index , i ) ;
525
525
index = i + 1 ;
526
526
527
527
// Get the start search index
@@ -533,7 +533,7 @@ function deserializeObject(
533
533
// If are at the end of the buffer there is a problem with the document
534
534
if ( i >= buffer . length ) throw new BSONError ( 'Bad BSON Document: illegal CString' ) ;
535
535
// Return the C string
536
- const regExpOptions = ByteUtils . toUTF8 ( buffer . subarray ( index , i ) ) ;
536
+ const regExpOptions = ByteUtils . toUTF8 ( buffer , index , i ) ;
537
537
index = i + 1 ;
538
538
539
539
// Set the object
@@ -678,7 +678,7 @@ function deserializeObject(
678
678
throw new BSONError ( 'Invalid UTF-8 string in BSON document' ) ;
679
679
}
680
680
}
681
- const namespace = ByteUtils . toUTF8 ( buffer . subarray ( index , index + stringSize - 1 ) ) ;
681
+ const namespace = ByteUtils . toUTF8 ( buffer , index , index + stringSize - 1 ) ;
682
682
// Update parse index position
683
683
index = index + stringSize ;
684
684
@@ -735,7 +735,7 @@ function getValidatedString(
735
735
end : number ,
736
736
shouldValidateUtf8 : boolean
737
737
) {
738
- const value = ByteUtils . toUTF8 ( buffer . subarray ( start , end ) ) ;
738
+ const value = ByteUtils . toUTF8 ( buffer , start , end ) ;
739
739
// if utf8 validation is on, do the check
740
740
if ( shouldValidateUtf8 ) {
741
741
for ( let i = 0 ; i < value . length ; i ++ ) {
0 commit comments