memoizerific
Advanced tools
Comparing version 1.8.4 to 1.8.6
(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.memoizerific = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | ||
if (typeof Map !== 'function' || (process && process.env && process.env.TEST_MAPORSIMILAR === 'true')) { | ||
module.exports = _dereq_('./similar'); | ||
} | ||
else { | ||
module.exports = Map; | ||
} | ||
},{"./similar":2}],2:[function(_dereq_,module,exports){ | ||
function Similar() { | ||
this.list = []; | ||
this.lastItem = undefined; | ||
this.size = 0; | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i;i="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,i.mapOrSimilar=t()}}(function(){var t,i,e;return function t(i,e,s){function n(o,l){if(!e[o]){if(!i[o]){var a="function"==typeof _dereq_&&_dereq_;if(!l&&a)return a(o,!0);if(r)return r(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var h=e[o]={exports:{}};i[o][0].call(h.exports,function(t){var e=i[o][1][t];return n(e?e:t)},h,h.exports,t,i,e,s)}return e[o].exports}for(var r="function"==typeof _dereq_&&_dereq_,o=0;o<s.length;o++)n(s[o]);return n}({1:[function(t,i,e){i.exports=function(i){if("function"!=typeof Map||i){var e=t("./similar");return new e}return new Map}},{"./similar":2}],2:[function(t,i,e){function s(){return this.list=[],this.lastItem=void 0,this.size=0,this}s.prototype.get=function(t){var i;return this.lastItem&&this.isEqual(this.lastItem.key,t)?this.lastItem.val:(i=this.indexOf(t),i>=0?(this.lastItem=this.list[i],this.list[i].val):void 0)},s.prototype.set=function(t,i){var e;return this.lastItem&&this.isEqual(this.lastItem.key,t)?(this.lastItem.val=i,this):(e=this.indexOf(t),e>=0?(this.lastItem=this.list[e],this.list[e].val=i,this):(this.lastItem={key:t,val:i},this.list.push(this.lastItem),this.size++,this))},s.prototype.delete=function(t){var i;if(this.lastItem&&this.isEqual(this.lastItem.key,t)&&(this.lastItem=void 0),i=this.indexOf(t),i>=0)return this.size--,this.list.splice(i,1)[0]},s.prototype.has=function(t){var i;return!(!this.lastItem||!this.isEqual(this.lastItem.key,t))||(i=this.indexOf(t),i>=0&&(this.lastItem=this.list[i],!0))},s.prototype.forEach=function(t,i){var e;for(e=0;e<this.size;e++)t.call(i||this,this.list[e].val,this.list[e].key,this)},s.prototype.indexOf=function(t){var i;for(i=0;i<this.size;i++)if(this.isEqual(this.list[i].key,t))return i;return-1},s.prototype.isEqual=function(t,i){return t===i||t!==t&&i!==i},i.exports=s},{}]},{},[1])(1)}); | ||
return this; | ||
} | ||
Similar.prototype.get = function(key) { | ||
var index; | ||
if (this.lastItem && this.isEqual(this.lastItem.key, key)) { | ||
return this.lastItem.val; | ||
} | ||
index = this.indexOf(key); | ||
if (index >= 0) { | ||
this.lastItem = this.list[index]; | ||
return this.list[index].val; | ||
} | ||
return undefined; | ||
}; | ||
Similar.prototype.set = function(key, val) { | ||
var index; | ||
if (this.lastItem && this.isEqual(this.lastItem.key, key)) { | ||
this.lastItem.val = val; | ||
return this; | ||
} | ||
index = this.indexOf(key); | ||
if (index >= 0) { | ||
this.lastItem = this.list[index]; | ||
this.list[index].val = val; | ||
return this; | ||
} | ||
this.lastItem = { key: key, val: val }; | ||
this.list.push(this.lastItem); | ||
this.size++; | ||
return this; | ||
}; | ||
Similar.prototype.delete = function(key) { | ||
var index; | ||
if (this.lastItem && this.isEqual(this.lastItem.key, key)) { | ||
this.lastItem = undefined; | ||
} | ||
index = this.indexOf(key); | ||
if (index >= 0) { | ||
this.size--; | ||
return this.list.splice(index, 1)[0]; | ||
} | ||
return undefined; | ||
}; | ||
// important that has() doesn't use get() in case an existing key has a falsy value, in which case has() would return false | ||
Similar.prototype.has = function(key) { | ||
var index; | ||
if (this.lastItem && this.isEqual(this.lastItem.key, key)) { | ||
return true; | ||
} | ||
index = this.indexOf(key); | ||
if (index >= 0) { | ||
this.lastItem = this.list[index]; | ||
return true; | ||
} | ||
return false; | ||
}; | ||
Similar.prototype.forEach = function(callback, thisArg) { | ||
var i; | ||
for (i = 0; i < this.size; i++) { | ||
callback.call(thisArg || this, this.list[i].val, this.list[i].key, this); | ||
} | ||
}; | ||
Similar.prototype.indexOf = function(key) { | ||
var i; | ||
for (i = 0; i < this.size; i++) { | ||
if (this.isEqual(this.list[i].key, key)) { | ||
return i; | ||
} | ||
} | ||
return -1; | ||
}; | ||
// check if the numbers are equal, or whether they are both precisely NaN (isNaN returns true for all non-numbers) | ||
Similar.prototype.isEqual = function(val1, val2) { | ||
return val1 === val2 || (val1 !== val1 && val2 !== val2); | ||
}; | ||
module.exports = Similar; | ||
},{}],3:[function(_dereq_,module,exports){ | ||
},{}],2:[function(_dereq_,module,exports){ | ||
var MapOrSimilar = _dereq_('map-or-similar'); | ||
module.exports = function (limit) { | ||
var cache = new MapOrSimilar(), | ||
var cache = new MapOrSimilar(undefined === 'true'), | ||
lru = []; | ||
@@ -141,3 +33,3 @@ | ||
// climb through the hierarchical map tree until the second-last argument has been found, or an argument is missing. | ||
// if all arguments up to the second-last have been found, this will potentially be a cache hit (determined below) | ||
// if all arguments up to the second-last have been found, this will potentially be a cache hit (determined later) | ||
if (currentCache.has(arguments[i])) { | ||
@@ -151,3 +43,3 @@ currentCache = currentCache.get(arguments[i]); | ||
// make maps until last value | ||
newMap = new MapOrSimilar(); | ||
newMap = new MapOrSimilar(undefined === 'true'); | ||
currentCache.set(arguments[i], newMap); | ||
@@ -254,3 +146,3 @@ currentCache = newMap; | ||
} | ||
},{"map-or-similar":1}]},{},[3])(3) | ||
},{"map-or-similar":1}]},{},[2])(2) | ||
}); |
@@ -1,4 +0,8 @@ | ||
� �gbW�VKo�8�}pE����M*c�,P�i}��`�Qĭ$�$�4���w(J��x�����{���$���Y���D�O��ߐ�)c��z����lZ�[HE �餿,����ce�'�<������f�?�Ŗ�����q��{�<����� ʭ|X����].oy�vg94�����&�BP@!�P"���i�!5�u�P�"R`jUz��g|�RMvE���6����;A{�jrv&' | ||
��BaR�Cde�l���^�J'Kb�eO+;��Z��+�����Ð�]��ӹ�O_LId2%�:H��{}���/�o>}�����7SZ7V_Ƭ�l��4�5Mdc�,� �y�g}��1���`-�*ޘ�O���Z��44��6�����&��&�H�����J���k�Pޙ,��9Q��I\h��*������|��5���J�4�;P�cU����������\_�u������.?��{a��E!r��$<\����.×ML_>up��Fv�X��Іٖi?�6o �^���tD��f��� ]6҆܁a�U�h��S7���B_}�y�������|`N���M�&(\��z,φ(6�G�>��H2Ǯ��:����������O��F!���X�Xh��CCm��9HU��1+9�r>w�NR������f�9Ha ���up�8 | ||
EW�H ������9v=��q��)�� '�������Ivkv2 �7��y$p�7a�ow�)Ƅ�g[ͱ���3Y�V��#8��� �Τ�k$��~a��]�N�:ѓ`�2ള!Mp��f�����8�pp�zvp��L7��f�ō�hǸ�����Y�b�%�H�<�.� ����Ww�A��d�*�_�S����!);H6G+�O��?tu�UL5U��X�$�q��d�R�`�2R4�+�P�����'z�����nZ,ȿ�=�����K�m | ||
^-�Z+':�� ��7��H7��_-g'� ;�j��)C�J�/�Ŋ&�R)�����-]a_,>ʺ�Tw��>q�gÊ����c���a6��=��:�z<��ڻ��l�qh2�i^���o3�z���[�1�^Q��J6>u�*�9E�p��ۆ�vX��4��Y�VvD }|E�.��]Y#Z��zx�T�S�)jϞhGjh�cn�{?ce��*��:o]vl��4��Era���s��l�־� �k�W_W�������ɨ�\wUڲ����Y���q*�0s"���ZȤj&(o�<:As�jb;o��UL�W�!�o� 2v�� | ||
� ��JX�WM��6��W�>8$L���e�������0�L��H�BR�lm��EI�lm���� ����p<K+�X�$��(R4W���)��%Wi���J[�X�+y�0�uu�r��#lU�E8�ၳ��?[�V�Yq�~�v{b���W�s:��Iȃz��G4���o�cR��<ݺ��f��P�/�E*�A]�܄c '"��VZݷ�"����D"E�̙ة�_�f��0:���_*��v�=�b�p돁��;��d��9���)��Zi4��I�l )�o�K������fZ=U��������_�>�v�ǧ��?��~N���˩��ۚFǺ�]��>LX���+72�m�Q��wv��%�؊���伳A��[-��X���3g� ^D�u�nu�s�h�X-�X"�@�C��q��h۲�����/�� ϿOx�X؆��1�.c�1\�+���9�.�)�$)����y�w��z�2����ʳ�-U�� | ||
��V�L�2��WY�Y����auF]�cV��{Vg/���Fq�j���7��H6`�ǫc�sy�j�F$&���cr | ||
L6H:p{�Ln�>��%�{O=9>��t��y�h�h<3��Ћz�����M�'7ס�L���ւca�c�k��3���U�C��BM��u��R+�\��#���&��vkN�{��K�r4�~��p�l�¯p��~��o�)� �-]o��i�ŎwY�gG> �0t3 | ||
�t�����U��7����,�w��,�~ll���#KX�>� | ||
��dcU|.�r�]@r�9�|��@���b������(��B\�ɘ2 ��a��)��Θy��34q:�^ �N/��*���;^� ]�%�$�\��S�m�q,��X�������,��]�~۰'Pq^��|�Ȁ���qi�PK[����©�z�lWUJ�KiM�)<���Ψ��{�C��c��5nD�t�3�Զ���%�-%������!�@�N �l��t�4swd݈�ӏ�������4g�kГ�/�3ֱSyv�z0s��T�����]F�P�$� ���K$嫛Xz�}vѡ>��Ny��ܺ))��j�_�[&��/E��`LY)�:_G�Z�����m����r9����� ����T0�f¬ | ||
.�iQ[mHB�i͞Q���+_��JCY���9�@� | ||
�_C*n��F�ˇ���><�LU�!`�{6�ܑ���l ��< |