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

utilsac

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

utilsac - npm Package Compare versions

Comparing version

to
4.2.0

2

package.json
{
"name": "utilsac",
"version": "4.1.0",
"version": "4.2.0",
"description": "tools mostly",

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

@@ -18,2 +18,3 @@ # Utilities and random js files

export {
createThrottledFunction,
createCustomRound,

@@ -20,0 +21,0 @@ fillArrayWithFunctionResult,

export {
createThrottledFunction,
createCustomRound,

@@ -11,2 +12,22 @@ fillArrayWithFunctionResult,

const createThrottledFunction = function (functionToThrottle, minimumTimeSpace) {
/* creates a function that is throttled,
calling it very often during a period less than minimumTimeSpace will only execute it once
an alternative implementation could use Date.now() , this means less performance
but would work for throttling inside a single tick
*/
let ready = true;
const makeReady = function() {
ready = true;
};
return function(...args) {
if (ready) {
ready = false;
functionToThrottle(...args);
timeout = setTimeout(makeReady, minimumTimeSpace);
}
};
};
const createCustomRound = function (precision) {

@@ -13,0 +34,0 @@ /* creates a function similar to Math.round (has precision of 1)