node_modules/bson/dist/bson.browser.esm.js
/*
 * isArray indicates if we are writing to a BSON array (type 0x04)
 * which forces the "key" which really an array index as a string to be written as ascii
 * This will catch any errors in index as a string generation
 */
isArray indicates if we are writing to a BSON array (type 0x04)
which forces the "key" which really an array index as a string to be written as ascii
This will catch any errors in index as a string generation
isArray indicates if we are writing to a BSON array ( type 0x04 ) which forces the " key " which really an array index as a string to be written as ascii This will catch any errors in index as a string generation
function serializeString(buffer, key, value, index, isArray) {
    buffer[index++] = BSON_DATA_STRING;
    var numberOfWrittenBytes = !isArray
        ? buffer.write(key, index, undefined, 'utf8')
        : buffer.write(key, index, undefined, 'ascii');
    index = index + numberOfWrittenBytes + 1;
    buffer[index - 1] = 0;
    var size = buffer.write(value, index + 4, undefined, 'utf8');
    buffer[index + 3] = ((size + 1) >> 24) & 0xff;
    buffer[index + 2] = ((size + 1) >> 16) & 0xff;
    buffer[index + 1] = ((size + 1) >> 8) & 0xff;
    buffer[index] = (size + 1) & 0xff;
    index = index + 4 + size;
    buffer[index++] = 0;
    return index;
}
function serializeString ( buffer , key , value , index , isArray ) { buffer [ index ++ ] = BSON_DATA_STRING ; var numberOfWrittenBytes = ! isArray ? buffer . write ( key , index , undefined , 'utf8' ) : buffer . write ( key , index , undefined , 'ascii' ) ; index = index + numberOfWrittenBytes + 1 ; buffer [ index - 1 ] = 0 ; var size = buffer . write ( value , index + 4 , undefined , 'utf8' ) ; buffer [ index + 3 ] = ( ( size + 1 ) >> 24 ) & 0xff ; buffer [ index + 2 ] = ( ( size + 1 ) >> 16 ) & 0xff ; buffer [ index + 1 ] = ( ( size + 1 ) >> 8 ) & 0xff ; buffer [ index ] = ( size + 1 ) & 0xff ; index = index + 4 + size ; buffer [ index ++ ] = 0 ; return index ; }
isArray indicates if we are writing to a BSON array (type 0x04)
 which forces the "key" which really an array index as a string to be written as ascii
 This will catch any errors in index as a string generation
isArray indicates if we are writing to a BSON array ( type 0x04 ) which forces the " key " which really an array index as a string to be written as ascii This will catch any errors in index as a string generation
// Encode String type // Number of written bytes // Encode the name // Write the string // Write the size of the string to buffer // Update index // Write zero