New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
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 7.1.0 to 8.0.1

12

files.js

@@ -15,3 +15,3 @@ /*files.js*/

const textFileContentPromiseFromPath = function (filePath) {
const textFileContent = function (filePath) {
return new Promise(function (resolve, reject) {

@@ -27,3 +27,3 @@ fs.readFile(filePath, "utf-8", function (error, data) {

const writeTextInFilePromiseFromPathAndString = function (filePath, string) {
const writeTextInFile = function (filePath, string) {
return new Promise(function (resolve, reject) {

@@ -42,5 +42,5 @@ createNecessaryDirectories(filePath);

const concatenateFiles = function (files, destination, separator=``) {
return Promise.all(files.map(textFileContentPromiseFromPath)).then(
return Promise.all(files.map(textFileContent)).then(
function (contents) {
return writeTextInFilePromiseFromPathAndString(
return writeTextInFile(
destination,

@@ -91,4 +91,4 @@ contents.join(separator)

module.exports = {
textFileContentPromiseFromPath,
writeTextInFilePromiseFromPathAndString,
textFileContent,
writeTextInFile,
concatenateFiles,

@@ -95,0 +95,0 @@ copyFile,

@@ -1,29 +0,25 @@

// operators.js
/*
/* operators.js
Exports common operands as functions
useful when working with Ramda and functions chaining
*/
// Also look at the Reflect API
export default (function () {
"use strict";
return {
'+': function (a, b) {
return a + b;
},
'-': function (a, b) {
return a - b;
},
'*': function (a, b) {
return a * b;
},
'/': function (a, b) {
return a / b;
},
'**': function (a, b) {
return Math.pow(a, b);
},
'===': function (a, b) {
return a === b;
},
};
}());
export default {
'+': function (a, b) {
return a + b;
},
'-': function (a, b) {
return a - b;
},
'*': function (a, b) {
return a * b;
},
'/': function (a, b) {
return a / b;
},
'**': function (a, b) {
return Math.pow(a, b);
},
'===': function (a, b) {
return a === b;
},
};
{
"name": "utilsac",
"version": "7.1.0",
"version": "8.0.1",
"description": "JavaScript General Purpose Utility Functions",

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

@@ -12,4 +12,4 @@ # JavaScript General Purpose Utility Functions

import {
textFileContentPromiseFromPath,
writeTextInFilePromiseFromPathAndString,
textFileContent,
writeTextInFile,
concatenateFiles,

@@ -31,6 +31,6 @@ copyFile,

import {
createDebouncedFunction,
createThrottledFunction,
createDebounced,
createThrottled,
createCustomRound,
fillArrayWithFunctionResult,
arrayWithResults,
chainPromises,

@@ -37,0 +37,0 @@ chainRequestAnimationFrame,

export {
createDebouncedFunction,
createThrottledFunction,
createDebounced,
createThrottled,
createThrottledUsingTimeout,
createCustomRound,
fillArrayWithFunctionResult,
arrayWithResults,
chainPromises,

@@ -15,3 +16,3 @@ chainRequestAnimationFrame,

const createDebouncedFunction = function (functionToDebounce, waitTime) {
const createDebounced = function (functionToDebounce, waitTime) {
/* creates a function that is de-bounced,

@@ -27,7 +28,7 @@ calling it, will eventually execute it, when you stop calling it

return function(...args) {
if (timeOutId > 0) {
if (timeOutId !== 0) {
clearTimeout(timeOutId);
timeOutId = 0;
}
timeOutId = setTimeout(function () {
timeOutId = 0;
functionToDebounce(...args);

@@ -38,3 +39,3 @@ }, waitTime);

const createThrottledFunction = function (functionToThrottle, minimumTimeSpace) {
const createThrottled = function (functionToThrottle, minimumTimeSpace) {
/* creates a function that is throttled,

@@ -46,5 +47,22 @@ calling it once will execute it immediately

an alternative implementation could use Date.now() , this means less performance
but would work for throttling inside a single long tick
*/
let lastTime = Number.MIN_SAFE_INTEGER;
return function(...args) {
const now = Date.now();
if (minimumTimeSpace > now - lastTime) {
return;
}
lastTime = now;
functionToThrottle(...args);
};
};
const createThrottledUsingTimeout = function (functionToThrottle, minimumTimeSpace) {
/* creates a function that is throttled,
calling it once will execute it immediately
calling it very often during a period less than minimumTimeSpace will only execute it once
the returned function always return undefined
*/
let ready = true;

@@ -87,3 +105,3 @@ const makeReady = function() {

const fillArrayWithFunctionResult = function (aFunction, times) {
const arrayWithResults = function (aFunction, times) {
/* [].fill is for static values only

@@ -90,0 +108,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