+4
-0
@@ -0,1 +1,5 @@ | ||
| #### v1.0.5 (2018-01-25) | ||
| - Fix: Correctly skips incorrect cached value return on mismatched argument length | ||
| #### v1.0.4 (2017-09-06) | ||
@@ -2,0 +6,0 @@ |
+13
-1
@@ -18,3 +18,15 @@ var memize = (function () { | ||
| searchCache: while ( node ) { | ||
| // Check whether node arguments match arguments | ||
| // Perform a shallow equality test to confirm that whether the node | ||
| // under test is a candidate for the arguments passed. Two arrays | ||
| // are shallowly equal if their length matches and each entry is | ||
| // strictly equal between the two sets. Avoid abstracting to a | ||
| // function which could incur an arguments leaking deoptimization. | ||
| // Check whether node arguments match arguments length | ||
| if ( node.args.length !== arguments.length ) { | ||
| node = node.next; | ||
| continue; | ||
| } | ||
| // Check whether node arguments match arguments values | ||
| for ( i = 0; i < len; i++ ) { | ||
@@ -21,0 +33,0 @@ if ( node.args[ i ] !== arguments[ i ] ) { |
@@ -1,1 +0,1 @@ | ||
| var memize=function(){"use strict";return function(n,r){function u(){var r,u,i=t,o=arguments.length;n:for(;i;){for(u=0;u<o;u++)if(i.n[u]!==arguments[u]){i=i.r;continue n}return i!==t&&(i===e&&(e=i.u),i.u.r=i.r,i.r&&(i.r.u=i.u),i.r=t,i.u=null,t.u=i,t=i),i.l}for(r=new Array(o),u=0;u<o;u++)r[u]=arguments[u];return i={n:r,l:n.apply(null,r)},t?(t.u=i,i.r=t):e=i,f===l?(e=e.u).r=null:f++,t=i,i.l}var l,t,e,f=0;return r&&r.t&&(l=r.t),u.clear=function(){t=null,e=null,f=0},u}}(); | ||
| var memize=function(){"use strict";return function(n,r){function u(){var r,u,i=t,o=arguments.length;n:for(;i;){if(i.n.length===arguments.length){for(u=0;u<o;u++)if(i.n[u]!==arguments[u]){i=i.r;continue n}return i!==t&&(i===e&&(e=i.u),i.u.r=i.r,i.r&&(i.r.u=i.u),i.r=t,i.u=null,t.u=i,t=i),i.l}i=i.r}for(r=new Array(o),u=0;u<o;u++)r[u]=arguments[u];return i={n:r,l:n.apply(null,r)},t?(t.u=i,i.r=t):e=i,f===l?(e=e.u).r=null:f++,t=i,i.l}var l,t,e,f=0;return r&&r.t&&(l=r.t),u.clear=function(){t=null,e=null,f=0},u}}(); |
+13
-1
@@ -15,3 +15,15 @@ module.exports = function memize( fn, options ) { | ||
| searchCache: while ( node ) { | ||
| // Check whether node arguments match arguments | ||
| // Perform a shallow equality test to confirm that whether the node | ||
| // under test is a candidate for the arguments passed. Two arrays | ||
| // are shallowly equal if their length matches and each entry is | ||
| // strictly equal between the two sets. Avoid abstracting to a | ||
| // function which could incur an arguments leaking deoptimization. | ||
| // Check whether node arguments match arguments length | ||
| if ( node.args.length !== arguments.length ) { | ||
| node = node.next; | ||
| continue; | ||
| } | ||
| // Check whether node arguments match arguments values | ||
| for ( i = 0; i < len; i++ ) { | ||
@@ -18,0 +30,0 @@ if ( node.args[ i ] !== arguments[ i ] ) { |
+1
-1
| { | ||
| "name": "memize", | ||
| "version": "1.0.4", | ||
| "version": "1.0.5", | ||
| "description": "Unabashedly-barebones memoization library with an aim toward speed", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+1
-1
@@ -111,3 +111,3 @@ Memize | ||
| If you haven't already, feel free to [glance over the source code](./index.js). It's fewer than 100 lines of code of heavily commented code, and should help provide substance to the implementation concepts. | ||
| If you haven't already, feel free to [glance over the source code](./index.js). It's approximately 100 lines of code of heavily commented code, and should help provide substance to the implementation concepts. | ||
@@ -114,0 +114,0 @@ Memize creates a [last-in first-out stack](https://en.wikipedia.org/wiki/Stack_(abstract_data_type)) implemented as a [doubly linked list](https://en.wikipedia.org/wiki/Doubly_linked_list). It biases recent access favoring real-world scenarios where the function is subsequently invoked multiple times with the same arguments. The choice to implement as a linked list is due to dramatically better performance characteristics compared to `Array#unshift` for surfacing an entry to the head of the list ([jsperf](https://jsperf.com/array-unshift-linked-list)). A downside of linked lists is inability to efficiently access arbitrary indices, but iterating from the beginning of the cache list is optimized by guaranteeing the list is sorted by recent access / insertion. |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
17793
6.95%234
9.35%