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

appolo-utils

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appolo-utils - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

19

lib/numbers.js

@@ -8,3 +8,3 @@ "use strict";

}
static random(min, max) {
static random(min, max, floating = false) {
if (max === undefined) {

@@ -14,4 +14,17 @@ max = min;

}
min = Math.ceil(min);
max = Math.floor(max);
let isInt = !floating && Number.isInteger(min) && Number.isInteger(min);
if (isInt) {
return Numbers.randomInt(min, max);
}
min = Math.min(min, max);
max = Math.max(max, max);
return (Math.random() * (max - min + 1)) + min;
}
static randomInt(min, max) {
if (max === undefined) {
max = min;
min = 0;
}
min = Math.ceil(Math.min(min, max));
max = Math.floor(Math.max(min, max));
return Math.floor(Math.random() * (max - min + 1)) + min;

@@ -18,0 +31,0 @@ }

@@ -7,3 +7,3 @@ export class Numbers {

public static random(min: number, max?: number): number {
public static random(min: number, max?: number, floating: boolean = false): number {

@@ -15,4 +15,23 @@ if (max === undefined) {

min = Math.ceil(min);
max = Math.floor(max);
let isInt = !floating && Number.isInteger(min) && Number.isInteger(min);
if (isInt) {
return Numbers.randomInt(min, max);
}
min = Math.min(min, max);
max = Math.max(max, max);
return (Math.random() * (max - min + 1)) + min;
}
public static randomInt(min: number, max?: number): number {
if (max === undefined) {
max = min;
min = 0;
}
min = Math.ceil(Math.min(min, max));
max = Math.floor(Math.max(min, max));
return Math.floor(Math.random() * (max - min + 1)) + min;

@@ -19,0 +38,0 @@ }

2

package.json

@@ -17,3 +17,3 @@ {

"main": "./index.js",
"version": "0.0.15",
"version": "0.0.16",
"license": "MIT",

@@ -20,0 +20,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

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