lib/operations/collection_ops.js
function processScope(scope) {
  if (!isObject(scope) || scope._bsontype === 'ObjectID') {
    return scope;
  }

  const keys = Object.keys(scope);
  let key;
  const new_scope = {};

  for (let i = keys.length - 1; i >= 0; i--) {
    key = keys[i];
    if ('function' === typeof scope[key]) {
      new_scope[key] = new Code(String(scope[key]));
    } else {
      new_scope[key] = processScope(scope[key]);
    }
  }

  return new_scope;
}
function processScope(scope) {
  if (!isObject(scope) || scope._bsontype === 'ObjectID') {
    return scope;
  }

  const keys = Object.keys(scope);
  let key;
  const new_scope = {};

  for (let i = keys.length - 1; i >= 0; i--) {
    key = keys[i];
    if ('function' === typeof scope[key]) {
      new_scope[key] = new Code(String(scope[key]));
    } else {
      new_scope[key] = processScope(scope[key]);
    }
  }

  return new_scope;
}
function processScope ( scope ) { if ( ! isObject ( scope ) || scope . _bsontype === 'ObjectID' ) { return scope ; } const keys = Object . keys ( scope ) ; let key ; const new_scope = { } ; for ( let i = keys . length - 1 ; i >= 0 ; i -- ) { key = keys [ i ] ; if ( 'function' === typeof scope [ key ] ) { new_scope [ key ] = new Code ( String ( scope [ key ] ) ) ; } else { new_scope [ key ] = processScope ( scope [ key ] ) ; } } return new_scope ; }
Functions that are passed as scope args must
be converted to Code instances.
@ignore
Functions that are passed as scope args must be converted to Code instances .