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

ml-array-max

Package Overview
Dependencies
Maintainers
5
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ml-array-max - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

8

lib/index.js

@@ -12,5 +12,9 @@ 'use strict';

}
if (input.length === 0) {
throw new Error('input must not be empty');
}
var max = input[0];
var l = input.length;
for (var i = 1; i < l; i++) {
for (var i = 1; i < input.length; i++) {
if (input[i] > max) max = input[i];

@@ -17,0 +21,0 @@ }

{
"name": "ml-array-max",
"version": "1.0.0",
"version": "1.0.1",
"description": "Get the maximum value in an array",

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

@@ -5,12 +5,12 @@ import max from '..';

it('should return the max', () => {
expect(max([])).toEqual(undefined);
expect(max([0])).toEqual(0);
expect(max([1])).toEqual(1);
expect(max([1, 2])).toEqual(2);
expect(max([1, 2, 1])).toEqual(2);
expect(max([3, 2, 1])).toEqual(3);
expect(max([0])).toBe(0);
expect(max([1])).toBe(1);
expect(max([1, 2])).toBe(2);
expect(max([1, 2, 1])).toBe(2);
expect(max([3, 2, 1])).toBe(3);
});
it('should throw on invalid value', () => {
expect(() => max()).toThrow(/input must be an array/);
expect(() => max([])).toThrow(/input must not be empty/);
});
});

@@ -10,5 +10,9 @@ /**

}
if (input.length === 0) {
throw new Error('input must not be empty');
}
var max = input[0];
var l = input.length;
for (var i = 1; i < l; i++) {
for (var i = 1; i < input.length; i++) {
if (input[i] > max) max = input[i];

@@ -15,0 +19,0 @@ }

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