node_modules/bson/dist/bson.browser.esm.js
/**
 * Makes sure that, if a Uint8Array is passed in, it is wrapped in a Buffer.
 *
 * @param potentialBuffer - The potential buffer
 * @returns Buffer the input if potentialBuffer is a buffer, or a buffer that
 * wraps a passed in Uint8Array
 * @throws TypeError If anything other than a Buffer or Uint8Array is passed in
 */
Makes sure that, if a Uint8Array is passed in, it is wrapped in a Buffer.
@param potentialBuffer - The potential buffer
@returns Buffer the input if potentialBuffer is a buffer, or a buffer that
wraps a passed in Uint8Array
@throws TypeError If anything other than a Buffer or Uint8Array is passed in
Makes sure that if a Uint8Array is passed in it is wrapped in a Buffer . @param potentialBuffer - The potential buffer @returns Buffer the input if potentialBuffer is a buffer or a buffer that wraps a passed in Uint8Array @throws TypeError If anything other than a Buffer or Uint8Array is passed in
function ensureBuffer(potentialBuffer) {
    if (ArrayBuffer.isView(potentialBuffer)) {
        return buffer_1.from(potentialBuffer.buffer, potentialBuffer.byteOffset, potentialBuffer.byteLength);
    }
    if (isAnyArrayBuffer(potentialBuffer)) {
        return buffer_1.from(potentialBuffer);
    }
    throw new TypeError('Must use either Buffer or TypedArray');
}
function ensureBuffer ( potentialBuffer ) { if ( ArrayBuffer . isView ( potentialBuffer ) ) { return buffer_1 . from ( potentialBuffer . buffer , potentialBuffer . byteOffset , potentialBuffer . byteLength ) ; } if ( isAnyArrayBuffer ( potentialBuffer ) ) { return buffer_1 . from ( potentialBuffer ) ; } throw new TypeError ( 'Must use either Buffer or TypedArray' ) ; }
Makes sure that, if a Uint8Array is passed in, it is wrapped in a Buffer.
Makes sure that if a Uint8Array is passed in it is wrapped in a Buffer .