Comparing version 6.0.1 to 6.0.2
@@ -0,0 +0,0 @@ // operators.js |
{ | ||
"name": "utilsac", | ||
"version": "6.0.1", | ||
"version": "6.0.2", | ||
"description": "JavaScript General Purpose Utility Functions", | ||
@@ -5,0 +5,0 @@ "main": "files.js", |
@@ -0,0 +0,0 @@ # JavaScript General Purpose Utility Functions |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ |
@@ -174,2 +174,5 @@ export { | ||
// these variables are not global because they are inside a module | ||
const separator = "-"; | ||
const previousResults = {}; | ||
const memoizeAsStrings = function (functionToMemoize) { | ||
@@ -181,4 +184,2 @@ /* | ||
*/ | ||
const separator = "-"; | ||
const previousResults = {}; | ||
return function (...args) { | ||
@@ -190,12 +191,8 @@ const argumentsAsStrings = args.map(String).join(separator); | ||
*/ | ||
if (Object.prototype.hasOwnProperty.call(previousResults, argumentsAsStrings)) { | ||
// cache hit | ||
return previousResults[argumentsAsStrings]; | ||
if (!Object.prototype.hasOwnProperty.call(previousResults, argumentsAsStrings)) { | ||
// not yet in cache | ||
previousResults[argumentsAsStrings] = functionToMemoize(...args); | ||
} | ||
// not yet in cache | ||
const result = functionToMemoize(...args); | ||
// add it for later | ||
previousResults[argumentsAsStrings] = result; | ||
return result; | ||
return previousResults[argumentsAsStrings]; | ||
}; | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20535
374