params = {collection:string, id:string, key:string, by:number}
502834
function incrementDocument(params) {
  var doc = (collections[params.collection] || {})[params.id]

  if (doc !== undefined) {
    doc[params.key] = (doc[params.key] || 0) + (params.by || 1)

    eventEmitter.emit('documentIncremented', params.collection, doc)
  }
}
912966
private String parameterToString(Object param) {
        if (param == null) {
            return "";
        } else if (param instanceof Date) {
            return formatDate((Date) param);
        } else if (param instanceof Collection) {
            StringBuilder b = new StringBuilder();
            for (Object o : (Collection) param) {
                if (b.length() > 0) {
                    b.append(",");
                }
                b.append(String.valueOf(o));
            }
            return b.toString();
        } else {
            return String.valueOf(param);
        }
    }
260866
def as_json(*args)
      document = { COLLECTION => collection, ID => id }
      document.merge!(DATABASE => database) if database
      document
    end
271531
function (key, def) {
                        if (angular.isArray(key)) {
                            var items = {};
                            angular.forEach(key, function (k) {
                                if (this.has(k)) items[k] = this._getItem(k);
                            }, this);

                            return items;
                        }

                        if (! this.has(key)) return arguments.length === 2 ? def : void 0;

                        return this._getItem(key);
                    }
138371
def set_param(self, key, value):
        
        self.__dict__[key] = value
        self._parameters[key] = value
207480
def _get_by_id(collection, id):
    '''
    
    '''
    matches = [item for item in collection if item.id == id]
    if not matches:
        raise ValueError('Could not find a matching item')
    elif len(matches) > 1:
        raise ValueError('The id matched {0} items, not 1'.format(len(matches)))
    return matches[0]
860990
function getKeys(params, key, allowEmpty) {
  if (!Array.isArray(params)) { throw new Error(`[ethjs-util] method getKeys expecting type Array as 'params' input, got '${typeof params}'`); }
  if (typeof key !== 'string') { throw new Error(`[ethjs-util] method getKeys expecting type String for input 'key' got '${typeof key}'.`); }

  var result = []; // eslint-disable-line

  for (var i = 0; i < params.length; i++) { // eslint-disable-line
    var value = params[i][key]; // eslint-disable-line
    if (allowEmpty && !value) {
      value = '';
    } else if (typeof(value) !== 'string') {
      throw new Error('invalid abi');
    }
    result.push(value);
  }

  return result;
}
311196
def parse_params(self, params):
        
        for (key, value) in params.items():
            if not isinstance(value, str):
                string_params = self.to_string(value)
                params[key] = string_params
        return params
1371964
def to_h
      sanitized_params.each_with_object({}) do |(key, value), hash|
        hash[key] = transform(key, value)
      end
    end
764234
function formatNumbers(prevParams, decimal) {
  var params = {}, value;
  for (var k in prevParams) {
    value = prevParams[k];
    params[k] = typeof value === 'number' ? decimal(value) : value;
  }
  return params;
}
731407
def build_collection_param(param, collection_format)
      case collection_format
      when :csv
        param.join(',')
      when :ssv
        param.join(' ')
      when :tsv
        param.join("\t")
      when :pipes
        param.join('|')
      when :multi
        # return the array directly as faraday will handle it as expected
        param
      else
        fail "unknown collection format: #{collection_format.inspect}"
      end
    end
926852
function(str, param) {
      var val;

      // Simple numerals such as "one" are mapped directly in
      // the numeral map so catch up front if there is a match.
      if (hasOwn(this.numeralMap, str)) {
        val = this.numeralMap[str];
      }

      // TODO: perf test isNaN vs other methods
      if (isNaN(val)) {
        val = this.parseRegularNumerals(str);
      }

      if (isNaN(val)) {
        val = this.parseIrregularNumerals(str);
      }

      if (param === 'month') {
        // Months are the only numeric date field
        // whose value is not the same as its number.
        val -= 1;
      }

      return val;
    }
583431
def set (self, id, param, value):
        
        assert isinstance(id, basestring)
        assert isinstance(param, basestring)
        assert is_iterable_typed(value, basestring)
        self.params_.setdefault(param, {})[id] = value
989278
function(params, callback) {
			var self = this;
			var collections = [];
		  // Get the collections for this dbName
	  	this.db.listCollections().toArray(function(err, colls) {
			  // Loop through the collections
	  		for (var n = 0; n < colls.length; n++) {

	  			var options = colls[n].options || {};
	  			// Remove the old name.
	  			delete options.create;
		  		// Remove the dbName from the collection name.
	  			options.name = parseName(colls[n].name);
	  			// Set the name as the _id.
	  			options._id = options.name;

	  			// Add it to the list.
	  	  	collections.push(options);
	  	  }

		  	// Async function to add stats to each collection.
		  	var addStats = function(coll, callback){
		  		// Switch databases
		  		var collection = self.db.collection(coll.name);
		  		// Get the stats. null if empty.
		  		collection.stats(function(err, stats){
		  			// Add the stats to the corresponding database.
		  			coll.stats = stats;
			  		callback(err, coll);
		  		});
		  	};

		  	async.each(collections, addStats, function(err){
	  	    if (err) {
	  	    	callback({error:err.errmsg});
	  	    } else {
	  	    	// Sort the collections
	  	    	collections.sort(function (a, b) {
	  	    		return (a.name > b.name) ? 1 : -1;
	  	    	});
	  	    	// Send the collections
					  return callback(null, collections);
	  	    }
		  	});
	  	});
		}
20168
def prepare_params(request):
    """"""
    return request.replace(
        params={key: dump_param(val) for key, val in request.params.items()
                if val is not None})
753779
def build_collection_param(param, collection_format)
      case collection_format
      when :csv
        param.join(',')
      when :ssv
        param.join(' ')
      when :tsv
        param.join("\t")
      when :pipes
        param.join('|')
      when :multi
        # return the array directly as faraday will handle it as expected
        param
      else
        raise "unknown collection format: #{collection_format.inspect}"
      end
    end
1104504
function normalizeParams(params) {
        if (params && params.constructor !== Array && typeof params === 'object') {
            params = _.mapKeys(params, function (value, key) {
                return ':' + _.trimStart(key, ':');
            });
        }
        return params;
    }