Socket
Socket
Sign inDemoInstall

bson

Package Overview
Dependencies
0
Maintainers
2
Versions
162
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.8 to 0.4.10

build/binding.Makefile

26

lib/bson/bson.js
// "use strict"
var writeIEEE754 = require('./float_parser').writeIEEE754
, readIEEE754 = require('./float_parser').readIEEE754
, Long = require('./long').Long
, Double = require('./double').Double
, Timestamp = require('./timestamp').Timestamp
, ObjectID = require('./objectid').ObjectID
, Symbol = require('./symbol').Symbol
, Code = require('./code').Code
, MinKey = require('./min_key').MinKey
, MaxKey = require('./max_key').MaxKey
, DBRef = require('./db_ref').DBRef
, Binary = require('./binary').Binary;
var writeIEEE754 = require('./float_parser').writeIEEE754,
readIEEE754 = require('./float_parser').readIEEE754,
Long = require('./long').Long,
Double = require('./double').Double,
Timestamp = require('./timestamp').Timestamp,
ObjectID = require('./objectid').ObjectID,
BSONRegExp = require('./regexp').BSONRegExp,
Symbol = require('./symbol').Symbol,
Code = require('./code').Code,
MinKey = require('./min_key').MinKey,
MaxKey = require('./max_key').MaxKey,
DBRef = require('./db_ref').DBRef,
Binary = require('./binary').Binary;

@@ -320,1 +321,2 @@ // Parts of the parser

module.exports.MaxKey = MaxKey;
module.exports.BSONRegExp = BSONRegExp;

@@ -15,2 +15,3 @@ try {

, './objectid'
, './regexp'
, './symbol'

@@ -37,2 +38,3 @@ , './timestamp'

, './objectid'
, './regexp'
, './symbol'

@@ -63,2 +65,3 @@ , './timestamp'

, './objectid'
, './regexp'
, './symbol'

@@ -65,0 +68,0 @@ , './timestamp'

@@ -10,2 +10,3 @@ "use strict"

, Symbol = require('../symbol').Symbol
, BSONRegExp = require('../regexp').BSONRegExp
, Code = require('../code').Code

@@ -27,3 +28,3 @@ , MinKey = require('../min_key').MinKey

for(var i = 0; i < object.length; i++) {
totalLength += calculateElement(i.toString(), object[i], serializeFunctions)
totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true)
}

@@ -49,3 +50,3 @@ } else {

*/
function calculateElement(name, value, serializeFunctions) {
function calculateElement(name, value, serializeFunctions, isArray) {
// If we have toBSON defined, override the current object

@@ -70,3 +71,4 @@ if(value && value.toBSON){

case 'undefined':
return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1);
if(isArray) return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1);
return 0;
case 'boolean':

@@ -118,2 +120,5 @@ return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1 + 1);

+ (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1
} else if(value instanceof BSONRegExp || value['_bsontype'] == 'BSONRegExp') {
return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.pattern, 'utf8') + 1
+ Buffer.byteLength(value.options, 'utf8') + 1
} else {

@@ -120,0 +125,0 @@ return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + calculateObjectSize(value, serializeFunctions) + 1;

@@ -15,2 +15,3 @@ "use strict"

DBRef = require('../db_ref').DBRef,
BSONRegExp = require('../regexp').BSONRegExp,
Binary = require('../binary').Binary;

@@ -63,2 +64,4 @@

var fieldsAsRaw = options['fieldsAsRaw'] == null ? {} : options['fieldsAsRaw'];
// Return BSONRegExp objects instead of native regular expressions
var bsonRegExp = typeof options['bsonRegExp'] == 'boolean' ? options['bsonRegExp'] : false;

@@ -190,3 +193,3 @@ // Validate that we have at least 4 bytes of buffer

index = index + objectSize;
} else if(elementType == BSON.BSON_DATA_REGEXP) {
} else if(elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == false) {
// Create the regexp

@@ -220,2 +223,14 @@ var r = readCStyleStringSpecial(buffer, index);

object[name] = new RegExp(source, optionsArray.join(''));
} else if(elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == true) {
// Create the regexp
var r = readCStyleStringSpecial(buffer, index);
var source = r.s;
index = r.i;
var r = readCStyleStringSpecial(buffer, index);
var regExpOptions = r.s;
index = r.i;
// Set the object
object[name] = new BSONRegExp(source, regExpOptions);
} else if(elementType == BSON.BSON_DATA_LONG) {

@@ -222,0 +237,0 @@ // Unpack the low and high bits

"use strict"
var writeIEEE754 = require('../float_parser').writeIEEE754
, readIEEE754 = require('../float_parser').readIEEE754
, Long = require('../long').Long
, Double = require('../double').Double
, Timestamp = require('../timestamp').Timestamp
, ObjectID = require('../objectid').ObjectID
, Symbol = require('../symbol').Symbol
, Code = require('../code').Code
, MinKey = require('../min_key').MinKey
, MaxKey = require('../max_key').MaxKey
, DBRef = require('../db_ref').DBRef
, Binary = require('../binary').Binary;
var writeIEEE754 = require('../float_parser').writeIEEE754,
readIEEE754 = require('../float_parser').readIEEE754,
Long = require('../long').Long,
Double = require('../double').Double,
Timestamp = require('../timestamp').Timestamp,
ObjectID = require('../objectid').ObjectID,
Symbol = require('../symbol').Symbol,
Code = require('../code').Code,
BSONRegExp = require('../regexp').BSONRegExp,
MinKey = require('../min_key').MinKey,
MaxKey = require('../max_key').MaxKey,
DBRef = require('../db_ref').DBRef,
Binary = require('../binary').Binary;
var regexp = /\x00/
// To ensure that 0.4 of node works correctly

@@ -21,18 +24,5 @@ var isDate = function isDate(d) {

var checkKey = function checkKey (key, dollarsAndDotsOk) {
if (!key.length) return;
// Check if we have a legal key for the object
if (!!~key.indexOf("\x00")) {
// The BSON spec doesn't allow keys with null bytes because keys are
// null-terminated.
throw Error("key " + key + " must not contain null bytes");
}
if (!dollarsAndDotsOk) {
if('$' == key[0]) {
throw Error("key " + key + " must not start with '$'");
} else if (!!~key.indexOf('.')) {
throw Error("key " + key + " must not contain '.'");
}
}
};
var isRegExp = function isRegExp(d) {
return Object.prototype.toString.call(d) === '[object RegExp]';
}

@@ -47,16 +37,11 @@ var serializeString = function(buffer, key, value, index) {

buffer[index - 1] = 0;
// Calculate size
var size = Buffer.byteLength(value) + 1;
// Write the string
var size = buffer.write(value, index + 4, 'utf8');
// Write the size of the string to buffer
buffer[index + 3] = (size >> 24) & 0xff;
buffer[index + 2] = (size >> 16) & 0xff;
buffer[index + 1] = (size >> 8) & 0xff;
buffer[index] = size & 0xff;
// Ajust the index
index = index + 4;
// Write the string
buffer.write(value, index, '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;
// Update index
index = index + size - 1;
index = index + 4 + size;
// Write zero

@@ -133,3 +118,3 @@ buffer[index++] = 0;

return index;
return index;
}

@@ -145,3 +130,3 @@

buffer[index++] = 0;
return index;
return index;
}

@@ -159,3 +144,3 @@

buffer[index++] = value ? 1 : 0;
return index;
return index;
}

@@ -186,3 +171,3 @@

buffer[index++] = (highBits >> 24) & 0xff;
return index;
return index;
}

@@ -198,7 +183,4 @@

buffer[index++] = 0;
// Write the regular expression string
buffer.write(value.source, index, 'utf8');
// Adjust the index
index = index + Buffer.byteLength(value.source);
index = index + buffer.write(value.source, index, 'utf8');
// Write zero

@@ -212,5 +194,24 @@ buffer[index++] = 0x00;

buffer[index++] = 0x00;
return index;
return index;
}
var serializeBSONRegExp = function(buffer, key, value, index) {
// Write the type
buffer[index++] = BSON.BSON_DATA_REGEXP;
// Number of written bytes
var numberOfWrittenBytes = buffer.write(key, index, 'utf8');
// Encode the name
index = index + numberOfWrittenBytes;
buffer[index++] = 0;
// Adjust the index
index = index + buffer.write(value.pattern, index, 'utf8');
// Write zero
buffer[index++] = 0x00;
// Write the options
index = index + buffer.write(value.options, index, 'utf8');
// Add ending zero
buffer[index++] = 0x00;
return index;
}
var serializeMinMax = function(buffer, key, value, index) {

@@ -240,11 +241,11 @@ // Write the type of either min or max key

// Encode the name
// Encode the name
index = index + numberOfWrittenBytes;
buffer[index++] = 0;
// Write the objectId into the shared buffer
buffer.write(value.id, index, 'binary')
// Write the objectId into the shared buffer
buffer.write(value.id, index, 'binary')
// Ajust index
return index + 12;
return index + 12;
}

@@ -273,3 +274,3 @@

index = index + size;
return index;
return index;
}

@@ -312,3 +313,3 @@

buffer[index++] = (highBits >> 24) & 0xff;
return index;
return index;
}

@@ -328,28 +329,26 @@

index = index + 8;
return index;
return index;
}
var serializeFunction = function(buffer, key, value, index, checkKeys, depth) {
buffer[index++] = BSON.BSON_DATA_CODE;
// Number of written bytes
var numberOfWrittenBytes = buffer.write(key, index, 'utf8');
// Encode the name
index = index + numberOfWrittenBytes;
buffer[index++] = 0;
// Function string
var functionString = value.toString();
// Function Size
var size = Buffer.byteLength(functionString) + 1;
// Write the size of the string to buffer
buffer[index++] = size & 0xff;
buffer[index++] = (size >> 8) & 0xff;
buffer[index++] = (size >> 16) & 0xff;
buffer[index++] = (size >> 24) & 0xff;
// Write the string
buffer.write(functionString, index, 'utf8');
// Update index
index = index + size - 1;
// Write zero
buffer[index++] = 0;
return index;
buffer[index++] = BSON.BSON_DATA_CODE;
// Number of written bytes
var numberOfWrittenBytes = buffer.write(key, index, 'utf8');
// Encode the name
index = index + numberOfWrittenBytes;
buffer[index++] = 0;
// Function string
var functionString = value.toString();
// Write the string
var size = buffer.write(functionString, index + 4, 'utf8') + 1;
// Write the size of the string to buffer
buffer[index] = size & 0xff;
buffer[index + 1] = (size >> 8) & 0xff;
buffer[index + 2] = (size >> 16) & 0xff;
buffer[index + 3] = (size >> 24) & 0xff;
// Update index
index = index + 4 + size - 1;
// Write zero
buffer[index++] = 0;
return index;
}

@@ -373,5 +372,6 @@

var functionString = typeof value.code == 'string' ? value.code : value.code.toString();
var codeSize = Buffer.byteLength(functionString) + 1;
// Index adjustment
index = index + 4;
// Write string into buffer
var codeSize = buffer.write(functionString, index + 4, 'utf8') + 1;
// Write the size of the string to buffer

@@ -382,4 +382,2 @@ buffer[index] = codeSize & 0xff;

buffer[index + 3] = (codeSize >> 24) & 0xff;
// Write string into buffer
buffer.write(functionString, index + 4, 'utf8');
// Write end 0

@@ -414,13 +412,11 @@ buffer[index + 4 + codeSize - 1] = 0;

var functionString = value.code.toString();
// Function Size
var size = Buffer.byteLength(functionString) + 1;
// Write the string
var size = buffer.write(functionString, index + 4, 'utf8') + 1;
// Write the size of the string to buffer
buffer[index++] = size & 0xff;
buffer[index++] = (size >> 8) & 0xff;
buffer[index++] = (size >> 16) & 0xff;
buffer[index++] = (size >> 24) & 0xff;
// Write the string
buffer.write(functionString, index, 'utf8');
buffer[index] = size & 0xff;
buffer[index + 1] = (size >> 8) & 0xff;
buffer[index + 2] = (size >> 16) & 0xff;
buffer[index + 3] = (size >> 24) & 0xff;
// Update index
index = index + size - 1;
index = index + 4 + size - 1;
// Write zero

@@ -430,3 +426,3 @@ buffer[index++] = 0;

return index;
return index;
}

@@ -466,3 +462,3 @@

index = index + value.position;
return index;
return index;
}

@@ -478,16 +474,14 @@

buffer[index++] = 0;
// Calculate size
var size = Buffer.byteLength(value.value) + 1;
// Write the string
var size = buffer.write(value.value, index + 4, 'utf8') + 1;
// Write the size of the string to buffer
buffer[index++] = size & 0xff;
buffer[index++] = (size >> 8) & 0xff;
buffer[index++] = (size >> 16) & 0xff;
buffer[index++] = (size >> 24) & 0xff;
// Write the string
buffer.write(value.value, index, 'utf8');
buffer[index] = size & 0xff;
buffer[index + 1] = (size >> 8) & 0xff;
buffer[index + 2] = (size >> 16) & 0xff;
buffer[index + 3] = (size >> 24) & 0xff;
// Update index
index = index + size - 1;
index = index + 4 + size - 1;
// Write zero
buffer[index++] = 0x00;
return index;
return index;
}

@@ -510,3 +504,3 @@

if(null != value.db) {
endIndex = serializeInto(buffer, {
endIndex = serializeInto(buffer, {
'$ref': value.namespace

@@ -517,3 +511,3 @@ , '$id' : value.oid

} else {
endIndex = serializeInto(buffer, {
endIndex = serializeInto(buffer, {
'$ref': value.namespace

@@ -536,127 +530,144 @@ , '$id' : value.oid

var serializeInto = function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions) {
startingIndex = startingIndex || 0;
startingIndex = startingIndex || 0;
// Start place to serialize into
var index = startingIndex + 4;
var self = this;
// Start place to serialize into
var index = startingIndex + 4;
var self = this;
// Special case isArray
if(Array.isArray(object)) {
// Get object keys
for(var i = 0; i < object.length; i++) {
var key = "" + i;
var value = object[i];
// Special case isArray
if(Array.isArray(object)) {
// Get object keys
for(var i = 0; i < object.length; i++) {
var key = "" + i;
var value = object[i];
// Is there an override value
if(value && value.toBSON) {
if(typeof value.toBSON != 'function') throw new Error("toBSON is not a function");
value = value.toBSON();
}
// Is there an override value
if(value && value.toBSON) {
if(typeof value.toBSON != 'function') throw new Error("toBSON is not a function");
value = value.toBSON();
}
var type = typeof value;
var type = typeof value;
if(type == 'string') {
index = serializeString(buffer, key, value, index);
} else if(type == 'number') {
index = serializeNumber(buffer, key, value, index);
} else if(type == 'undefined' || value == null) {
index = serializeUndefined(buffer, key, value, index);
} else if(type == 'boolean') {
index = serializeBoolean(buffer, key, value, index);
} else if(value instanceof Date || isDate(value)) {
index = serializeDate(buffer, key, value, index);
} else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') {
index = serializeRegExp(buffer, key, value, index);
} else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {
index = serializeMinMax(buffer, key, value, index);
} else if(value['_bsontype'] == 'ObjectID') {
index = serializeObjectId(buffer, key, value, index);
} else if(Buffer.isBuffer(value)) {
index = serializeBuffer(buffer, key, value, index);
} else if(type == 'object' && value['_bsontype'] == null) {
index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions);
} else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {
index = serializeLong(buffer, key, value, index);
} else if(value['_bsontype'] == 'Double') {
index = serializeDouble(buffer, key, value, index);
} else if(typeof value == 'function' && serializeFunctions) {
index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);
} else if(value['_bsontype'] == 'Code') {
index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions);
} else if(value['_bsontype'] == 'Binary') {
index = serializeBinary(buffer, key, value, index);
} else if(value['_bsontype'] == 'Symbol') {
index = serializeSymbol(buffer, key, value, index);
} else if(value['_bsontype'] == 'DBRef') {
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);
}
}
} else {
// Did we provide a custom serialization method
if(object.toBSON) {
if(typeof object.toBSON != 'function') throw new Error("toBSON is not a function");
object = object.toBSON();
if(object != null && typeof object != 'object') throw new Error("toBSON function did not return an object");
}
if(type == 'string') {
index = serializeString(buffer, key, value, index);
} else if(type == 'number') {
index = serializeNumber(buffer, key, value, index);
} else if(type == 'boolean') {
index = serializeBoolean(buffer, key, value, index);
} else if(value instanceof Date || isDate(value)) {
index = serializeDate(buffer, key, value, index);
} else if(type == 'undefined' || value == null) {
index = serializeUndefined(buffer, key, value, index);
} else if(value['_bsontype'] == 'ObjectID') {
index = serializeObjectId(buffer, key, value, index);
} else if(Buffer.isBuffer(value)) {
index = serializeBuffer(buffer, key, value, index);
} else if(value instanceof RegExp || isRegExp(value)) {
index = serializeRegExp(buffer, key, value, index);
} else if(type == 'object' && value['_bsontype'] == null) {
index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions);
} else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {
index = serializeLong(buffer, key, value, index);
} else if(value['_bsontype'] == 'Double') {
index = serializeDouble(buffer, key, value, index);
} else if(typeof value == 'function' && serializeFunctions) {
index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);
} else if(value['_bsontype'] == 'Code') {
index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions);
} else if(value['_bsontype'] == 'Binary') {
index = serializeBinary(buffer, key, value, index);
} else if(value['_bsontype'] == 'Symbol') {
index = serializeSymbol(buffer, key, value, index);
} else if(value['_bsontype'] == 'DBRef') {
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);
} else if(value['_bsontype'] == 'BSONRegExp') {
index = serializeBSONRegExp(buffer, key, value, index);
} else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {
index = serializeMinMax(buffer, key, value, index);
}
}
} else {
// Did we provide a custom serialization method
if(object.toBSON) {
if(typeof object.toBSON != 'function') throw new Error("toBSON is not a function");
object = object.toBSON();
if(object != null && typeof object != 'object') throw new Error("toBSON function did not return an object");
}
// Iterate over all the keys
for(var key in object) {
var value = object[key];
// Is there an override value
if(value && value.toBSON) {
if(typeof value.toBSON != 'function') throw new Error("toBSON is not a function");
value = value.toBSON();
}
// Iterate over all the keys
for(var key in object) {
var value = object[key];
// Is there an override value
if(value && value.toBSON) {
if(typeof value.toBSON != 'function') throw new Error("toBSON is not a function");
value = value.toBSON();
}
// Check the type of the value
var type = typeof value;
// Check the type of the value
var type = typeof value;
// Check the key and throw error if it's illegal
if(key != '$db' && key != '$ref' && key != '$id') {
checkKey(key, !checkKeys);
}
// Check the key and throw error if it's illegal
if(key != '$db' && key != '$ref' && key != '$id') {
if (key.match(regexp) != null) {
// The BSON spec doesn't allow keys with null bytes because keys are
// null-terminated.
throw Error("key " + key + " must not contain null bytes");
}
if (!checkKeys) {
if('$' == key[0]) {
throw Error("key " + key + " must not start with '$'");
} else if (!!~key.indexOf('.')) {
throw Error("key " + key + " must not contain '.'");
}
}
}
if(type == 'string') {
index = serializeString(buffer, key, value, index);
} else if(type == 'number') {
index = serializeNumber(buffer, key, value, index);
} else if(type == 'undefined' || value == null) {
index = serializeUndefined(buffer, key, value, index);
} else if(type == 'boolean') {
index = serializeBoolean(buffer, key, value, index);
} else if(value instanceof Date || isDate(value)) {
index = serializeDate(buffer, key, value, index);
} else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') {
index = serializeRegExp(buffer, key, value, index);
} else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {
index = serializeMinMax(buffer, key, value, index);
} else if(value['_bsontype'] == 'ObjectID') {
index = serializeObjectId(buffer, key, value, index);
} else if(Buffer.isBuffer(value)) {
index = serializeBuffer(buffer, key, value, index);
} else if(type == 'object' && value['_bsontype'] == null) {
index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions);
} else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {
index = serializeLong(buffer, key, value, index);
} else if(value['_bsontype'] == 'Double') {
index = serializeDouble(buffer, key, value, index);
} else if(value['_bsontype'] == 'Code') {
index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions);
} else if(typeof value == 'function' && serializeFunctions) {
index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);
} else if(value['_bsontype'] == 'Binary') {
index = serializeBinary(buffer, key, value, index);
} else if(value['_bsontype'] == 'Symbol') {
index = serializeSymbol(buffer, key, value, index);
} else if(value['_bsontype'] == 'DBRef') {
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);
}
}
}
index = serializeString(buffer, key, value, index);
} else if(type == 'number') {
index = serializeNumber(buffer, key, value, index);
} else if(type == 'boolean') {
index = serializeBoolean(buffer, key, value, index);
} else if(value instanceof Date || isDate(value)) {
index = serializeDate(buffer, key, value, index);
} else if(value === undefined) {
} else if(value === null) {
index = serializeUndefined(buffer, key, value, index);
} else if(value['_bsontype'] == 'ObjectID') {
index = serializeObjectId(buffer, key, value, index);
} else if(Buffer.isBuffer(value)) {
index = serializeBuffer(buffer, key, value, index);
} else if(value instanceof RegExp || isRegExp(value)) {
index = serializeRegExp(buffer, key, value, index);
} else if(type == 'object' && value['_bsontype'] == null) {
index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions);
} else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') {
index = serializeLong(buffer, key, value, index);
} else if(value['_bsontype'] == 'Double') {
index = serializeDouble(buffer, key, value, index);
} else if(value['_bsontype'] == 'Code') {
index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions);
} else if(typeof value == 'function' && serializeFunctions) {
index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions);
} else if(value['_bsontype'] == 'Binary') {
index = serializeBinary(buffer, key, value, index);
} else if(value['_bsontype'] == 'Symbol') {
index = serializeSymbol(buffer, key, value, index);
} else if(value['_bsontype'] == 'DBRef') {
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions);
} else if(value['_bsontype'] == 'BSONRegExp') {
index = serializeBSONRegExp(buffer, key, value, index);
} else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') {
index = serializeMinMax(buffer, key, value, index);
}
}
}
// Final padding byte for object
buffer[index++] = 0x00;
// Final padding byte for object
buffer[index++] = 0x00;
// Final size
var size = index - startingIndex;
// Final size
var size = index - startingIndex;
// Write the size of the object

@@ -663,0 +674,0 @@ buffer[startingIndex++] = size & 0xff;

{ "name" : "bson"
, "description" : "A bson parser for node.js and the browser"
, "keywords" : ["mongodb", "bson", "parser"]
, "version" : "0.4.8"
, "version" : "0.4.10"
, "author" : "Christian Amor Kvalheim <christkv@gmail.com>"

@@ -6,0 +6,0 @@ , "contributors" : []

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc