node_modules/bson/dist/bson.esm.js
/**
 * Serialize a Javascript object.
 *
 * @param object - the Javascript object to serialize.
 * @returns Buffer object containing the serialized object.
 * @public
 */
Serialize a Javascript object.
@param object - the Javascript object to serialize.
@returns Buffer object containing the serialized object.
@public
Serialize a Javascript object . @param object - the Javascript object to serialize . @returns Buffer object containing the serialized object . @public
function serialize(object, options) {
    if (options === void 0) { options = {}; }
    var checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
    var serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
    var ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
    var minInternalBufferSize = typeof options.minInternalBufferSize === 'number' ? options.minInternalBufferSize : MAXSIZE;
    if (buffer.length < minInternalBufferSize) {
        buffer = Buffer.alloc(minInternalBufferSize);
    }
    var serializationIndex = serializeInto(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, []);
    var finishedBuffer = Buffer.alloc(serializationIndex);
    buffer.copy(finishedBuffer, 0, 0, finishedBuffer.length);
    return finishedBuffer;
}
function serialize ( object , options ) { if ( options === void 0 ) { options = { } ; } var checkKeys = typeof options . checkKeys === 'boolean' ? options . checkKeys : false ; var serializeFunctions = typeof options . serializeFunctions === 'boolean' ? options . serializeFunctions : false ; var ignoreUndefined = typeof options . ignoreUndefined === 'boolean' ? options . ignoreUndefined : true ; var minInternalBufferSize = typeof options . minInternalBufferSize === 'number' ? options . minInternalBufferSize : MAXSIZE ; if ( buffer . length < minInternalBufferSize ) { buffer = Buffer . alloc ( minInternalBufferSize ) ; } var serializationIndex = serializeInto ( buffer , object , checkKeys , 0 , 0 , serializeFunctions , ignoreUndefined , [ ] ) ; var finishedBuffer = Buffer . alloc ( serializationIndex ) ; buffer . copy ( finishedBuffer , 0 , 0 , finishedBuffer . length ) ; return finishedBuffer ; }
Serialize a Javascript object.
Serialize a Javascript object .
// Unpack the options // Resize the internal serialization buffer if needed // Attempt to serialize // Create the final buffer // Copy into the finished buffer // Return the buffer