lib/values-builder.js
function copyFromValueBuilder(otherValueBuilder) {
  var tb = new ValueBuilder();

  // TODO: share with QueryBuilder
  if (otherValueBuilder != null) {
    var clauseKeys = [
      'fromIndexesClause', 'whereClause',      'aggregatesClause',
      'sliceClause',       'withOptionsClause'
    ];
    var isString = (typeof otherValueBuilder === 'string' || otherValueBuilder instanceof String);
    var other = isString ?
        JSON.parse(otherValueBuilder) : otherValueBuilder;
    for (var i=0; i < clauseKeys.length; i++){
      var key = clauseKeys[i];
      var value = other[key];
      if (value != null) {
        // deepcopy instead of clone to avoid preserving prototype
        tb[key] = isString ? value : deepcopy(value);
      }
    }
  }

  return tb;
}
function copyFromValueBuilder(otherValueBuilder) {
  var tb = new ValueBuilder();

  // TODO: share with QueryBuilder
  if (otherValueBuilder != null) {
    var clauseKeys = [
      'fromIndexesClause', 'whereClause',      'aggregatesClause',
      'sliceClause',       'withOptionsClause'
    ];
    var isString = (typeof otherValueBuilder === 'string' || otherValueBuilder instanceof String);
    var other = isString ?
        JSON.parse(otherValueBuilder) : otherValueBuilder;
    for (var i=0; i < clauseKeys.length; i++){
      var key = clauseKeys[i];
      var value = other[key];
      if (value != null) {
        // deepcopy instead of clone to avoid preserving prototype
        tb[key] = isString ? value : deepcopy(value);
      }
    }
  }

  return tb;
}
function copyFromValueBuilder ( otherValueBuilder ) { var tb = new ValueBuilder ( ) ; // TODO: share with QueryBuilder if ( otherValueBuilder != null ) { var clauseKeys = [ 'fromIndexesClause' , 'whereClause' , 'aggregatesClause' , 'sliceClause' , 'withOptionsClause' ] ; var isString = ( typeof otherValueBuilder === 'string' || otherValueBuilder instanceof String ) ; var other = isString ? JSON . parse ( otherValueBuilder ) : otherValueBuilder ; for ( var i = 0 ; i < clauseKeys . length ; i ++ ) { var key = clauseKeys [ i ] ; var value = other [ key ] ; if ( value != null ) { // deepcopy instead of clone to avoid preserving prototype tb [ key ] = isString ? value : deepcopy ( value ) ; } } } return tb ; }
Initializes a new values builder by copying the from indexes clause
and any where, aggregates, slice, or withOptions clause defined in
the built query.
@method valuesBuilder#copyFrom
@since 1.0
@param {valuesBuilder.BuiltQuery} query - an existing values query
with clauses to copy
@returns {valuesBuilder.BuiltQuery} a built query
Initializes a new values builder by copying the from indexes clause and any where aggregates slice or withOptions clause defined in the built query .