'use strict';

/**
 * Internal dependencies
 */
let SampleProportion = require( './sample-proportion' );

function Variation( name, color, participants, conversions ) {
	this.name = name;
	this.color = color;
	this.participants = participants;
	this.conversions = conversions;
	this.proportion = new SampleProportion( participants, conversions );
}

// See: http://blog.42floors.com/math-split-testing-part-2-chance-better/
Variation.prototype.isGaussian = function() {
	let np = this.participants * this.proportion.mean,
		nq = this.participants * ( 1 - this.proportion.mean );

	return this.participants >= 30 && np >= 5 && nq >= 5;
};

module.exports = Variation;

@@ -99,24 +99,21 @@
 on' );%0A%0A
-function
+class
  Variati
@@ -114,16 +114,31 @@
 ariation
+ %7B%0A%09constructor
 ( name, 
@@ -174,16 +174,17 @@
 ons ) %7B%0A
+%09
 %09this.na
@@ -194,16 +194,17 @@
 = name;%0A
+%09
 %09this.co
@@ -216,16 +216,17 @@
  color;%0A
+%09
 %09this.pa
@@ -252,16 +252,17 @@
 ipants;%0A
+%09
 %09this.co
@@ -286,16 +286,17 @@
 rsions;%0A
+%09
 %09this.pr
@@ -361,11 +361,13 @@
  );%0A
+%09
 %7D%0A%0A
+%09
 // S
@@ -440,54 +440,25 @@
 er/%0A
-Variation.prototype.isGaussian = functio
+%09isGaussia
 n() %7B%0A
+%09
 %09let
@@ -505,16 +505,17 @@
 n.mean,%0A
+%09
 %09%09nq = t
@@ -564,16 +564,17 @@
 ean );%0A%0A
+%09
 %09return 
@@ -624,10 +624,13 @@
  5;%0A
+%09
 %7D;
+%0A%7D
 %0A%0Amo

Convert Variation class to ES6