schema/keyspaceBuilder.js
function _getStrategyGrouping(_class) {

  return function () {

    var replicationParams = _.toArray(arguments)
      , replication = {"class": _class};

    if (_class === methods.withSimpleStrategy.name) {
      if (typeof replicationParams[0] === "undefined")
        throw new Error("SimpleStrategy requires replication parameters.");

      replication.replication_factor = replicationParams[0];
    }
    else if (_class === methods.withNetworkTopologyStrategy.name) {

      var filter = function (param) {
        return typeof param === "object" && Object.keys(param).length >= 1;
      };
      var dataCenterParams = _.filter(arguments, filter);
      if (!dataCenterParams.length)
        throw new Error("NetworkTopologyStrategy requires a variable length argument list of data center param objecs => '{ dataCenterName: dataCenterReplicationFactor }'.");

      _.each(dataCenterParams, function (dataCenterParam) {
        _.each(Object.keys(dataCenterParam), function (k) {
          replication[k] = dataCenterParam[k];
        });
      });
    }

    this._statements.push({
      grouping: "strategy",
      type: methods[nameToCallMap[_class]].name,
      value: replication
    });

    return this;
  };
}
function _getStrategyGrouping(_class) {

  return function () {

    var replicationParams = _.toArray(arguments)
      , replication = {"class": _class};

    if (_class === methods.withSimpleStrategy.name) {
      if (typeof replicationParams[0] === "undefined")
        throw new Error("SimpleStrategy requires replication parameters.");

      replication.replication_factor = replicationParams[0];
    }
    else if (_class === methods.withNetworkTopologyStrategy.name) {

      var filter = function (param) {
        return typeof param === "object" && Object.keys(param).length >= 1;
      };
      var dataCenterParams = _.filter(arguments, filter);
      if (!dataCenterParams.length)
        throw new Error("NetworkTopologyStrategy requires a variable length argument list of data center param objecs => '{ dataCenterName: dataCenterReplicationFactor }'.");

      _.each(dataCenterParams, function (dataCenterParam) {
        _.each(Object.keys(dataCenterParam), function (k) {
          replication[k] = dataCenterParam[k];
        });
      });
    }

    this._statements.push({
      grouping: "strategy",
      type: methods[nameToCallMap[_class]].name,
      value: replication
    });

    return this;
  };
}
function _getStrategyGrouping ( _class ) { return function ( ) { var replicationParams = _ . toArray ( arguments ) , replication = { "class" : _class } ; if ( _class === methods . withSimpleStrategy . name ) { if ( typeof replicationParams [ 0 ] === "undefined" ) throw new Error ( "SimpleStrategy requires replication parameters." ) ; replication . replication_factor = replicationParams [ 0 ] ; } else if ( _class === methods . withNetworkTopologyStrategy . name ) { var filter = function ( param ) { return typeof param === "object" && Object . keys ( param ) . length >= 1 ; } ; var dataCenterParams = _ . filter ( arguments , filter ) ; if ( ! dataCenterParams . length ) throw new Error ( "NetworkTopologyStrategy requires a variable length argument list of data center param objecs => '{ dataCenterName: dataCenterReplicationFactor }'." ) ; _ . each ( dataCenterParams , function ( dataCenterParam ) { _ . each ( Object . keys ( dataCenterParam ) , function ( k ) { replication [ k ] = dataCenterParam [ k ] ; } ) ; } ) ; } this . _statements . push ( { grouping : "strategy" , type : methods [ nameToCallMap [ _class ] ] . name , value : replication } ) ; return this ; } ; }
Returns function used to build the `with replication` clause in a create keyspace statement

@param _class
@returns {Function}
@private
Returns function used to build the with replication clause in a create keyspace statement