Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cachelru

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cachelru - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

bower.json

@@ -40,3 +40,3 @@ {

"name": "cachelru",
"version": "1.0.0"
"version": "1.0.1"
}

@@ -45,3 +45,3 @@ {

},
"version": "1.0.0"
"version": "1.0.1"
}

@@ -1,2 +0,2 @@

!function(e,r){"function"==typeof define&&define.amd?define(function(){return e.CacheLRU=r()}):"object"==typeof module&&module.exports?module.exports=e.CacheLRU=r():e.CacheLRU=r()}(this,function(){"use strict";function e(e){function r(e,r,t,n){return e=parseFloat(e),!isFinite(e)||isNaN(e)?r:(e=parseFloat(e.toFixed(0)),arguments.length<4&&(n=Number.MAX_VALUE,arguments.length<3&&(t=0,arguments.length<2&&(r=0))),isFinite(e)?e>n?n:t>e?t:e:r)}var t=2,n=r(e,t,t,Number.MAX_VALUE),i=0,o={},a=this;a.destroy=function(){a.head=a.tail=void 0,i=0,o={}},a.get=function(e,r){var t=o[e];if(void 0!==t)return t===a.tail?r?t:t.value:(t.newer&&(t===a.head&&(a.head=t.newer),t.newer.older=t.older),t.older&&(t.older.newer=t.newer),t.newer=void 0,t.older=a.tail,a.tail&&(a.tail.newer=t),a.tail=t,r?t:t.value)},a.isSet=function(e){return o[e]},a.iterate=function(e,r,t){var n;if("object"!=typeof r&&(r=a),t)for(n=a.tail;n;)e.call(r,n.key,n.value,a),n=n.older;else for(n=a.head;n;)e.call(r,n.key,n.value,a),n=n.newer},a.keys=function(){return Object.keys(o).sort()},Object.defineProperty(a,"limit",{get:function(){return n},set:function(e){e=parseInt(e),(isNaN(e)||!isFinite(e)||t>e)&&(e=t),n=e,i-e&&_.times(i-e,a.shift.bind(a))}}),a.put=function(e,r){var t={key:e,value:r};return o[e]=t,a.tail?(a.tail.newer=t,t.older=a.tail):a.head=t,a.tail=t,i===n?a.shift():(i+=1,null)},a.remove=function(e){var r=o[e];if(r)return delete o[r.key],r.newer&&r.older?(r.older.newer=r.newer,r.newer.older=r.older):r.newer?(r.newer.older=void 0,a.head=r.newer):r.older?(r.older.newer=void 0,a.tail=r.older):void 0===r.older&&void 0===r.newer&&(a.head=a.tail=void 0),i--,r.value},a.set=function(e,r){var t,n=a.get(e,!0);return n?(t=n.value,n.value=r):(t=a.put(e,r),t&&(t=t.value)),t},a.shift=function(){var e=a.head;return e&&(a.head.newer?(a.head=a.head.newer,a.head.older=void 0):a.head=void 0,e.newer=e.older=void 0,delete o[e.key]),e}}return e});
!function(e,r){"function"==typeof define&&define.amd?define(function(){return e.CacheLRU=r()}):"object"==typeof module&&module.exports?module.exports=e.CacheLRU=r():e.CacheLRU=r()}(this,function(){"use strict";function e(e){function r(e,r,t,n){return e=parseFloat(e),!isFinite(e)||isNaN(e)?r:(e=parseFloat(e.toFixed(0)),arguments.length<4&&(n=Number.MAX_VALUE,arguments.length<3&&(t=0,arguments.length<2&&(r=0))),isFinite(e)?e>n?n:t>e?t:e:r)}function t(e,r){for(var t=new Array(Math.max(0,e)),n=0;e>n;n+=1)t[n]=r.call();return t}var n=2,i=r(e,n,n,Number.MAX_VALUE),o=0,a={},l=this;l.destroy=function(){l.head=l.tail=void 0,o=0,a={}},l.get=function(e,r){var t=a[e];if(void 0!==t)return t===l.tail?r?t:t.value:(t.newer&&(t===l.head&&(l.head=t.newer),t.newer.older=t.older),t.older&&(t.older.newer=t.newer),t.newer=void 0,t.older=l.tail,l.tail&&(l.tail.newer=t),l.tail=t,r?t:t.value)},l.isSet=function(e){return a[e]},l.iterate=function(e,r,t){var n;if("object"!=typeof r&&(r=l),t)for(n=l.tail;n;)e.call(r,n.key,n.value,l),n=n.older;else for(n=l.head;n;)e.call(r,n.key,n.value,l),n=n.newer},l.keys=function(){return Object.keys(a).sort()},Object.defineProperty(l,"limit",{get:function(){return i},set:function(e){e=parseInt(e),(isNaN(e)||!isFinite(e)||n>e)&&(e=n),i=e,o-e&&t(o-e,l.shift.bind(l))}}),l.put=function(e,r){var t={key:e,value:r};return a[e]=t,l.tail?(l.tail.newer=t,t.older=l.tail):l.head=t,l.tail=t,o===i?l.shift():(o+=1,null)},l.remove=function(e){var r=a[e];if(r)return delete a[r.key],r.newer&&r.older?(r.older.newer=r.newer,r.newer.older=r.older):r.newer?(r.newer.older=void 0,l.head=r.newer):r.older?(r.older.newer=void 0,l.tail=r.older):void 0===r.older&&void 0===r.newer&&(l.head=l.tail=void 0),o--,r.value},l.set=function(e,r){var t,n=l.get(e,!0);return n?(t=n.value,n.value=r):(t=l.put(e,r),t&&(t=t.value)),t},l.shift=function(){var e=l.head;return e&&(l.head.newer?(l.head=l.head.newer,l.head.older=void 0):l.head=void 0,e.newer=e.older=void 0,delete a[e.key]),e}}return e});
//# sourceMappingURL=release/cachelru.min.js.map

@@ -89,2 +89,18 @@ (function (root, factory) {

/**
* Invokes the given iteratee function <times>.
* Each invocation of iteratee is called with an index argument. Produces an array of the returned values.
* @param {number} times
* @param {Function} iterator
* @returns {Array}
* @private
*/
function _times(times, iterator) {
var accum = new Array(Math.max(0, times));
for (var index = 0; index < times; index += 1) {
accum[index] = iterator.call();
}
return accum;
}
/**
* Removes all entries

@@ -206,3 +222,3 @@ * @public

if (_currentSize - value) {
_.times(_currentSize - value, scope.shift.bind(scope));
_times(_currentSize - value, scope.shift.bind(scope));
}

@@ -209,0 +225,0 @@ }

Sorry, the diff of this file is not supported yet

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