New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

z-score

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

z-score - npm Package Compare versions

Comparing version 1.0.3 to 1.0.5

2

lib/zscore.js

@@ -54,3 +54,3 @@ 'use strict';

var zScores = _lodash2.default.mapValues(dataItem, function (dataValue, dataKey) {
if (_lodash2.default.isNumber(dataValue)) {
if (_lodash2.default.isNumber(dataValue) && _this2.data[dataKey]) {
var difference = dataValue - _this2.data[dataKey].mean;

@@ -57,0 +57,0 @@ return difference / _this2.data[dataKey].stdDev;

{
"name": "z-score",
"version": "1.0.3",
"version": "1.0.5",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/zscore.js",

@@ -32,3 +32,3 @@ import _ from 'lodash'

const zScores = _.mapValues(dataItem, (dataValue, dataKey) => {
if(_.isNumber(dataValue)) {
if(_.isNumber(dataValue) && this.data[dataKey]) {
const difference = dataValue - this.data[dataKey].mean

@@ -35,0 +35,0 @@ return difference / this.data[dataKey].stdDev

@@ -31,2 +31,13 @@ export const staticTemperature = [

}
]
export const dataSetWithNullItems = [
{
temperature: -5,
pressure: null
},
{
temperature: -4,
pressure: null
}
]
import ZScore from '../src/zscore'
import { staticTemperature, increasingTemperature } from './fixtures/weather'
import { staticTemperature, increasingTemperature, dataSetWithNullItems } from './fixtures/weather'
import { expect } from 'chai'

@@ -86,4 +86,14 @@

it('should calculate the correct z scores with null values in dataset', () => {
zScore.train(dataSetWithNullItems)
expect(zScore.calculate({
temperature: -10,
pressure: 101280
})).to.deep.equal({
temperature: -11
})
})
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc