Comparing version 1.0.2 to 1.0.3
@@ -53,6 +53,11 @@ 'use strict'; | ||
return _lodash2.default.mapValues(dataItem, function (dataValue, dataKey) { | ||
var difference = dataValue - _this2.data[dataKey].mean; | ||
return difference / _this2.data[dataKey].stdDev; | ||
var zScores = _lodash2.default.mapValues(dataItem, function (dataValue, dataKey) { | ||
if (_lodash2.default.isNumber(dataValue)) { | ||
var difference = dataValue - _this2.data[dataKey].mean; | ||
return difference / _this2.data[dataKey].stdDev; | ||
} | ||
}); | ||
return _lodash2.default.pickBy(zScores, function (zScore) { | ||
return !_lodash2.default.isUndefined(zScore); | ||
}); | ||
} | ||
@@ -59,0 +64,0 @@ }]); |
{ | ||
"name": "z-score", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/zscore.js", |
@@ -31,6 +31,11 @@ import _ from 'lodash' | ||
calculate(dataItem) { | ||
return _.mapValues(dataItem, (dataValue, dataKey) => { | ||
const difference = dataValue - this.data[dataKey].mean | ||
return difference / this.data[dataKey].stdDev | ||
const zScores = _.mapValues(dataItem, (dataValue, dataKey) => { | ||
if(_.isNumber(dataValue)) { | ||
const difference = dataValue - this.data[dataKey].mean | ||
return difference / this.data[dataKey].stdDev | ||
} | ||
}) | ||
return _.pickBy(zScores, zScore => { | ||
return !_.isUndefined(zScore) | ||
}) | ||
} | ||
@@ -37,0 +42,0 @@ |
@@ -59,2 +59,3 @@ import ZScore from '../src/zscore' | ||
expect(zScore.calculate({ | ||
description: 'cloudy', | ||
temperature: 11 | ||
@@ -61,0 +62,0 @@ })).to.deep.equal({ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
9845
234
0