ui-number-input
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -28,3 +28,4 @@ import Ember from 'ember'; | ||
sum: null, | ||
average: null, | ||
mean: null, | ||
median: null, | ||
@@ -99,6 +100,21 @@ // observers and event handlers | ||
}); | ||
samples.sort(function(a,b) {return a-b}); // put into order, lowest to highest | ||
this.set('samples', samples); | ||
this.set('sum', sum); | ||
var average = samples.length === 0 ? null : sum / samples.length; | ||
this.set('average', average); | ||
var sampleSize = samples.length ? samples.length : 0; | ||
this.set('sampleSize', sampleSize); | ||
var median; | ||
var midPoint = Math.floor(sampleSize / 2); | ||
if (sampleSize % 2 === 0 && sampleSize !== 0) { | ||
median = (samples[midPoint] + samples[midPoint - 1]) / 2; | ||
} else if (sampleSize !== 0) { | ||
median = samples[midPoint]; | ||
} else { | ||
median = null; | ||
} | ||
this.set('median',median); | ||
var mean = samples.length === 0 ? null : sum / samples.length; | ||
this.set('mean', mean); | ||
this.set('minValue', samples ? samples[0] : null); | ||
this.set('maxValue', samples ? samples[samples.length -1] : null); | ||
}); | ||
@@ -105,0 +121,0 @@ }.observes('arrayElements.@each.value'), |
{ | ||
"name": "ui-number-input", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "HTML Number input with Bootstrap and mobile friendly features", | ||
@@ -5,0 +5,0 @@ "directories": { |
Sorry, the diff of this file is not supported yet
98896
1184