Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vx/mock-data

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vx/mock-data - npm Package Compare versions

Comparing version 0.0.165 to 0.0.179

120

build/generators/genStats.js
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});

@@ -12,3 +12,3 @@ exports.default = genStats;

var randomOffset = function randomOffset() {
return Math.random() * 10;
return Math.random() * 10;
};

@@ -18,73 +18,73 @@ var sampleSize = 1000;

function genStats(number) {
var data = [];
var i = void 0;
var data = [];
var i = void 0;
var _loop = function _loop() {
var points = [];
var j = void 0;
var offset = randomOffset();
for (j = 0; j < sampleSize; j += 1) {
points.push(offset + random());
}
var _loop = function _loop() {
var points = [];
var j = void 0;
var offset = randomOffset();
for (j = 0; j < sampleSize; j += 1) {
points.push(offset + random());
}
points.sort(function (a, b) {
return a - b;
});
points.sort(function (a, b) {
return a - b;
});
var firstQuartile = points[Math.round(sampleSize / 4)];
var thirdQuartile = points[Math.round(3 * sampleSize / 4)];
var IQR = thirdQuartile - firstQuartile;
var firstQuartile = points[Math.round(sampleSize / 4)];
var thirdQuartile = points[Math.round(3 * sampleSize / 4)];
var IQR = thirdQuartile - firstQuartile;
var min = firstQuartile - 1.5 * IQR;
var max = thirdQuartile + 1.5 * IQR;
var min = firstQuartile - 1.5 * IQR;
var max = thirdQuartile + 1.5 * IQR;
var outliers = points.filter(function (p) {
return p < min || p > max;
});
var binWidth = 2 * IQR * Math.pow(sampleSize - outliers.length, -1 / 3);
var binNum = Math.round((max - min) / binWidth);
var actualBinWidth = (max - min) / binNum;
var outliers = points.filter(function (p) {
return p < min || p > max;
});
var binWidth = 2 * IQR * Math.pow(sampleSize - outliers.length, -1 / 3);
var binNum = Math.round((max - min) / binWidth);
var actualBinWidth = (max - min) / binNum;
var bins = Array(binNum + 2).fill(0);
var values = Array(binNum + 2).fill(min);
var bins = Array(binNum + 2).fill(0);
var values = Array(binNum + 2).fill(min);
for (var _i = 1; _i <= binNum; _i += 1) {
values[_i] += actualBinWidth * (_i - 0.5);
}
for (var ii = 1; ii <= binNum; ii += 1) {
values[ii] += actualBinWidth * (ii - 0.5);
}
values[values.length - 1] = max;
values[values.length - 1] = max;
points.filter(function (p) {
return p >= min && p <= max;
}).forEach(function (p) {
bins[Math.floor((p - min) / actualBinWidth) + 1] += 1;
});
points.filter(function (p) {
return p >= min && p <= max;
}).forEach(function (p) {
bins[Math.floor((p - min) / actualBinWidth) + 1] += 1;
});
var binData = values.map(function (v, i) {
return {
value: v,
count: bins[i]
};
});
var binData = values.map(function (v, index) {
return {
value: v,
count: bins[index]
};
});
var boxPlot = {
x: 'Statistics ' + i,
min: min,
firstQuartile: firstQuartile,
median: points[Math.round(sampleSize / 2)],
thirdQuartile: thirdQuartile,
max: max,
outliers: outliers
var boxPlot = {
x: 'Statistics ' + i,
min: min,
firstQuartile: firstQuartile,
median: points[Math.round(sampleSize / 2)],
thirdQuartile: thirdQuartile,
max: max,
outliers: outliers
};
data.push({
boxPlot: boxPlot,
binData: binData
});
};
data.push({
boxPlot: boxPlot,
binData: binData
});
};
for (i = 0; i < number; i += 1) {
_loop();
}
return data;
for (i = 0; i < number; i += 1) {
_loop();
}
return data;
}
{
"name": "@vx/mock-data",
"version": "0.0.165",
"version": "0.0.179",
"description": "vx mock data",

@@ -5,0 +5,0 @@ "sideEffects": false,

Sorry, the diff of this file is too big to display

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