🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

node-powertools

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-powertools - npm Package Compare versions

Comparing version

to
2.2.1

18

dist/index.js

@@ -88,2 +88,20 @@ (function (root, factory) {

Powertools.chance = function (probability, options) {
// Ensure probability is between 0 and 1
if (probability <= 0) {
return false;
} else if (probability >= 1) {
return true;
}
// Use a big number factor for precision
var factor = 1000000;
// Generate a random number between 0 and the factor, then scale it to 0-1
var randomValue = Powertools.random(0, factor, options) / factor;
// Compare the scaled random value to the probability
return randomValue <= probability;
};
// Ensure input is an array

@@ -90,0 +108,0 @@ Powertools.arrayify = function (input) {

2

package.json
{
"name": "node-powertools",
"version": "2.2.0",
"version": "2.2.1",
"description": "Powerful assistive functions for Node and Browser environments.",

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