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

array-normalize

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-normalize - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

14

index.js

@@ -16,7 +16,17 @@ 'use strict'

if (max === Infinity || min === -Infinity) {
if (max === Infinity && min === -Infinity) {
for (let i = 0, l = arr.length; i < l; i++) {
arr[i] = arr[i] === min ? min : arr[i] === max ? max : 0;
arr[i] = arr[i] === max ? 1 : arr[i] === min ? 0 : .5
}
}
else if (max === Infinity) {
for (let i = 0, l = arr.length; i < l; i++) {
arr[i] = arr[i] === max ? 1 : 0
}
}
else if (min === -Infinity) {
for (let i = 0, l = arr.length; i < l; i++) {
arr[i] = arr[i] === min ? 0 : 1
}
}
else {

@@ -23,0 +33,0 @@ for (let i = 0, l = arr.length; i < l; i++) {

2

package.json
{
"name": "array-normalize",
"version": "1.0.0",
"version": "1.0.1",
"description": "Normalize array to zero mean and unit variance",

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

@@ -5,3 +5,3 @@ const norm = require('./')

let a = [-Infinity, -1, 0, 1, Infinity]
assert.deepEqual(norm(a.slice()), [-Infinity, 0, 0, 0, Infinity])
assert.deepEqual(norm(a.slice()), [0, 0.5, 0.5, 0.5, 1])

@@ -8,0 +8,0 @@ let b = [0, .5, 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