function conditionallyMergeWriteConcern(target, source) {
  let found = false;
  for (const wcKey of WRITE_CONCERN_KEYS) {
    if (wcKey in target) {
      // Found a writeConcern option
      found = true;
      break;
    }
  }

  if (!found) {
    for (const wcKey of WRITE_CONCERN_KEYS) {
      if (source[wcKey]) {
        if (!('writeConcern' in target)) {
          target.writeConcern = {};
        }
        target.writeConcern[wcKey] = source[wcKey];
      }
    }
  }

  return target;
}
/**
 * If there is no WriteConcern related options defined on target then inherit from source.
 * Otherwise, do not inherit **any** options from source.
 * @internal
 * @param {object} target - options object conditionally receiving the writeConcern options
 * @param {object} source - options object containing the potentially inherited writeConcern options
 */
If there is no WriteConcern related options defined on target then inherit from source.
Otherwise, do not inherit **any** options from source.
@internal
@param {object} target - options object conditionally receiving the writeConcern options
@param {object} source - options object containing the potentially inherited writeConcern options
If there is no WriteConcern related options defined on target then inherit from source . Otherwise do not inherit ** any ** options from source . @internal @param { object } target - options object conditionally receiving the writeConcern options @param { object } source - options object containing the potentially inherited writeConcern options
function conditionallyMergeWriteConcern(target, source) {
  let found = false;
  for (const wcKey of WRITE_CONCERN_KEYS) {
    if (wcKey in target) {
      found = true;
      break;
    }
  }
  if (!found) {
    for (const wcKey of WRITE_CONCERN_KEYS) {
      if (source[wcKey]) {
        if (!('writeConcern' in target)) {
          target.writeConcern = {};
        }
        target.writeConcern[wcKey] = source[wcKey];
      }
    }
  }
  return target;
}
function conditionallyMergeWriteConcern ( target , source ) { let found = false ; for ( const wcKey of WRITE_CONCERN_KEYS ) { if ( wcKey in target ) { found = true ; break ; } } if ( ! found ) { for ( const wcKey of WRITE_CONCERN_KEYS ) { if ( source [ wcKey ] ) { if ( ! ( 'writeConcern' in target ) ) { target . writeConcern = { } ; } target . writeConcern [ wcKey ] = source [ wcKey ] ; } } } return target ; }
If there is no WriteConcern related options defined on target then inherit from source.
If there is no WriteConcern related options defined on target then inherit from source .
// Found a writeConcern option