Comparing version 1.1.5 to 1.1.6
@@ -49,5 +49,5 @@ /* | ||
presets: [ | ||
[ "env", { | ||
[ "@babel/preset-env", { | ||
"targets": { | ||
"browser": [ "last 2 versions" ] | ||
"browsers": "last 2 versions, > 1%, ie 11" | ||
} | ||
@@ -54,0 +54,0 @@ } ] |
@@ -26,4 +26,4 @@ /* | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.CacheLRU = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(_dereq_,module,exports){ | ||
"use strict";var _createClass=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var CacheLRU=function(){function e(){return _classCallCheck(this,e),this._index={},this._LRU={newer:null},this._MRU={older:null},this._LRU.newer=this._MRU,this._MRU.older=this._LRU,this._cur=0,this._max=1/0,this._dispose=function(){},this}return _createClass(e,[{key:"limit",value:function(e){var t=this._max;return arguments.length>0&&(this._max=e,this._purge()),t}},{key:"dispose",value:function(e){return this._dispose=e,this}},{key:"length",value:function(){return this._cur}},{key:"keys",value:function(){return this.each(function(e,t){this.push(t)},[])}},{key:"values",value:function(){return this.each(function(e){this.push(e)},[])}},{key:"each",value:function(e,t){arguments<2&&(t=this);for(var i=0,n=this._MRU.older;n!==this._LRU;)e.call(t,n.val,n.key,i++),n=n.older;return t}},{key:"has",value:function(e){return void 0!==this._index[e]}},{key:"peek",value:function(e){var t=this._index[e];if(void 0!==t){if(!(t.expires<Date.now()))return t.val;this.del(t.key)}}},{key:"touch",value:function(e){var t=this._index[e];if(void 0===t)throw new Error("touch: no such item");return this._promote(t),this}},{key:"get",value:function(e){var t=this._index[e];if(void 0!==t){if(!(t.expires<Date.now()))return this._promote(t),t.val;this.del(t.key)}}},{key:"set",value:function(e,t,i){arguments.length<3&&(i=1/0),i+=Date.now();var n=this._index[e];if(void 0===n)n={older:null,newer:null,key:e,val:t,expires:i},this._index[e]=n,this._attach(n),this._cur++,this._purge();else{var r=n.val;n.val=t,this._promote(n),this._dispose.call(void 0,n.key,r,"set")}return this}},{key:"del",value:function(e){var t=this._index[e];if(void 0===t)throw new Error("del: no such item");return delete this._index[e],this._detach(t),this._cur--,this._dispose.call(void 0,e,t.val,"del"),this}},{key:"clear",value:function(){for(;this._cur>0;)this.del(this._LRU.newer.key);return this}},{key:"_purge",value:function(){for(;this._cur>this._max;)this.del(this._LRU.newer.key)}},{key:"_promote",value:function(e){this._detach(e),this._attach(e)}},{key:"_detach",value:function(e){e.older.newer=e.newer,e.newer.older=e.older,e.older=null,e.newer=null}},{key:"_attach",value:function(e){e.older=this._MRU.older,e.newer=this._MRU,e.newer.older=e,e.older.newer=e}}]),e}();module.exports=CacheLRU; | ||
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,i){return t&&_defineProperties(e.prototype,t),i&&_defineProperties(e,i),e}var CacheLRU=function(){function e(){return _classCallCheck(this,e),this._index={},this._LRU={newer:null},this._MRU={older:null},this._LRU.newer=this._MRU,this._MRU.older=this._LRU,this._cur=0,this._max=1/0,this._dispose=function(){},this}return _createClass(e,[{key:"limit",value:function(e){var t=this._max;return arguments.length>0&&(this._max=e,this._purge()),t}},{key:"dispose",value:function(e){return this._dispose=e,this}},{key:"length",value:function(){return this._cur}},{key:"keys",value:function(){return this.each(function(e,t){this.push(t)},[])}},{key:"values",value:function(){return this.each(function(e){this.push(e)},[])}},{key:"each",value:function(e,t){arguments<2&&(t=this);for(var i=0,n=this._MRU.older;n!==this._LRU;)e.call(t,n.val,n.key,i++),n=n.older;return t}},{key:"has",value:function(e){return void 0!==this._index[e]}},{key:"peek",value:function(e){var t=this._index[e];if(void 0!==t){if(!(t.expires<Date.now()))return t.val;this.del(t.key)}}},{key:"touch",value:function(e){var t=this._index[e];if(void 0===t)throw new Error("touch: no such item");return this._promote(t),this}},{key:"get",value:function(e){var t=this._index[e];if(void 0!==t){if(!(t.expires<Date.now()))return this._promote(t),t.val;this.del(t.key)}}},{key:"set",value:function(e,t,i){arguments.length<3&&(i=1/0),i+=Date.now();var n=this._index[e];if(void 0===n)n={older:null,newer:null,key:e,val:t,expires:i},this._index[e]=n,this._attach(n),this._cur++,this._purge();else{var r=n.val;n.val=t,this._promote(n),this._dispose.call(void 0,n.key,r,"set")}return this}},{key:"del",value:function(e){var t=this._index[e];if(void 0===t)throw new Error("del: no such item");return delete this._index[e],this._detach(t),this._cur--,this._dispose.call(void 0,e,t.val,"del"),this}},{key:"clear",value:function(){for(;this._cur>0;)this.del(this._LRU.newer.key);return this}},{key:"_purge",value:function(){for(;this._cur>this._max;)this.del(this._LRU.newer.key)}},{key:"_promote",value:function(e){this._detach(e),this._attach(e)}},{key:"_detach",value:function(e){e.older.newer=e.newer,e.newer.older=e.older,e.older=null,e.newer=null}},{key:"_attach",value:function(e){e.older=this._MRU.older,e.newer=this._MRU,e.newer.older=e,e.older.newer=e}}]),e}();module.exports=CacheLRU; | ||
},{}]},{},[1])(1) | ||
}); |
{ | ||
"name": "cache-lru", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "In-Memory Cache with O(1) Operations and LRU Purging Strategy", | ||
@@ -24,19 +24,19 @@ "keywords": [ "cache", "lru" ], | ||
"grunt": "1.0.3", | ||
"grunt-cli": "1.2.0", | ||
"grunt-contrib-clean": "1.1.0", | ||
"grunt-cli": "1.3.2", | ||
"grunt-contrib-clean": "2.0.0", | ||
"grunt-browserify": "5.3.0", | ||
"grunt-mocha-test": "0.13.3", | ||
"grunt-eslint": "20.2.0", | ||
"babel-eslint": "8.2.4", | ||
"eslint": "5.0.0", | ||
"eslint-config-standard": "11.0.0", | ||
"eslint-plugin-standard": "3.1.0", | ||
"eslint-plugin-promise": "3.8.0", | ||
"eslint-plugin-import": "2.12.0", | ||
"eslint-plugin-node": "6.0.1", | ||
"grunt-eslint": "21.0.0", | ||
"babel-eslint": "10.0.1", | ||
"eslint": "5.10.0", | ||
"eslint-config-standard": "12.0.0", | ||
"eslint-plugin-standard": "4.0.0", | ||
"eslint-plugin-promise": "4.0.1", | ||
"eslint-plugin-import": "2.14.0", | ||
"eslint-plugin-node": "8.0.0", | ||
"mocha": "5.2.0", | ||
"chai": "4.1.2", | ||
"babelify": "8.0.0", | ||
"babel-core": "6.26.3", | ||
"babel-preset-env": "1.7.0", | ||
"chai": "4.2.0", | ||
"babelify": "10.0.0", | ||
"@babel/core": "7.2.2", | ||
"@babel/preset-env": "7.2.3", | ||
"uglifyify": "5.0.1", | ||
@@ -43,0 +43,0 @@ "browserify-header": "0.9.4", |
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
29896