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

stats-lite

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stats-lite - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

package.json
{
"name": "stats-lite",
"version": "2.0.0",
"version": "2.0.1",
"description": "A light statistical package that operates on numeric Arrays.",

@@ -5,0 +5,0 @@ "main": "stats.js",

@@ -97,3 +97,3 @@ stats-lite

Calculate the value reprecenting the desired [percentile](http://en.wikipedia.org/wiki/Percentile) `(0 < ptile <= 1)`. Uses the Estimation method to interpolate non-member percentiles.
Calculate the value representing the desired [percentile](http://en.wikipedia.org/wiki/Percentile) `(0 < ptile <= 1)`. Uses the Estimation method to interpolate non-member percentiles.

@@ -100,0 +100,0 @@ LICENSE

@@ -15,7 +15,7 @@ "use strict";

function numbers(vals) {
let nums = []
var nums = []
if (vals == null)
return nums
for (let i = 0; i < vals.length; i++) {
for (var i = 0; i < vals.length; i++) {
if (isNumber(vals[i]))

@@ -33,4 +33,4 @@ nums.push(+vals[i])

vals = numbers(vals)
let total = 0
for (let i = 0; i < vals.length; i++) {
var total = 0
for (var i = 0; i < vals.length; i++) {
total += vals[i]

@@ -51,3 +51,3 @@ }

let half = (vals.length / 2) | 0
var half = (vals.length / 2) | 0

@@ -70,8 +70,8 @@ vals = nsort(vals)

if (vals.length === 0) return NaN
let mode = NaN
let dist = {}
var mode = NaN
var dist = {}
for (let i = 0; i < vals.length; i++) {
let value = vals[i]
let me = dist[value] || 0
for (var i = 0; i < vals.length; i++) {
var value = vals[i]
var me = dist[value] || 0
me++

@@ -81,3 +81,3 @@ dist[value] = me

let rank = numbers(Object.keys(dist).sort(function sortMembers(a, b) { return dist[b] - dist[a] }))
var rank = numbers(Object.keys(dist).sort(function sortMembers(a, b) { return dist[b] - dist[a] }))
mode = rank[0]

@@ -90,5 +90,5 @@ if (dist[rank[1]] == dist[mode]) {

}
let modes = new Set([mode])
let modeCount = dist[mode]
for (let i = 1; i < rank.length; i++) {
var modes = new Set([mode])
var modeCount = dist[mode]
for (var i = 1; i < rank.length; i++) {
if (dist[rank[i]] == modeCount) {

@@ -109,5 +109,5 @@ modes.add(rank[i])

vals = numbers(vals)
let avg = mean(vals)
let diffs = []
for (let i = 0; i < vals.length; i++) {
var avg = mean(vals)
var diffs = []
for (var i = 0; i < vals.length; i++) {
diffs.push(Math.pow((vals[i] - avg), 2))

@@ -130,8 +130,8 @@ }

vals = nsort(vals)
let i = (vals.length * ptile) - 0.5
var i = (vals.length * ptile) - 0.5
if ((i | 0) === i) return vals[i]
// interpolated percentile -- using Estimation method
let int_part = i | 0
let fract = i - int_part
return (1 - fract) * vals[int_part] + fract * vals[int_part + 1]
var int_part = i | 0
var fract = i - int_part
return (1 - fract) * vals[int_part] + fract * vals[Math.min(int_part + 1, vals.length - 1)]
}
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