*
* @see http://en.wikipedia.org/wiki/Jenkins_hash_function
*
- * @param {String} string String to hash
- * @return {Number} The hash as a 32-bit unsigned integer
+ * @param {string} string String to hash
+ * @return {number} The hash as a 32-bit unsigned integer
* @ignore
*
* @author Ori Livneh <ori@wikimedia.org>
* This function is based on the deprecated `mw.user.bucket` function.
*
* @param {Object} experiment
- * @param {String} experiment.name The name of the experiment
- * @param {Boolean} experiment.enabled Whether or not the experiment is
+ * @param {string} experiment.name The name of the experiment
+ * @param {boolean} experiment.enabled Whether or not the experiment is
* enabled. If the experiment is disabled, then the user is always assigned
* to the control bucket
* @param {Object} experiment.buckets A map of bucket name to probability
* that the user will be assigned to that bucket
- * @param {String} token A token that uniquely identifies the user for the
+ * @param {string} token A token that uniquely identifies the user for the
* duration of the experiment
- * @returns {String} The bucket
+ * @returns {string} The bucket
*/
getBucket: function ( experiment, token ) {
var buckets = experiment.buckets,
}
for ( key in buckets ) {
- range += buckets[key];
+ range += buckets[ key ];
}
hash = hashString( experiment.name + ':' + token );
max = ( hash / MAX_INT32_UNSIGNED ) * range;
for ( key in buckets ) {
- acc += buckets[key];
+ acc += buckets[ key ];
if ( max <= acc ) {
return key;