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

memoizerific

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memoizerific - npm Package Compare versions

Comparing version 1.8.6 to 1.9.0

118

memoizerific.js
(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){
!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)});
module.exports = function(forceSimilar) {
if (typeof Map !== 'function' || forceSimilar) {
var Similar = _dereq_('./similar');
return new Similar();
}
else {
return new Map();
}
}
},{}],2:[function(_dereq_,module,exports){
},{"./similar":2}],2:[function(_dereq_,module,exports){
function Similar() {
this.list = [];
this.lastItem = undefined;
this.size = 0;
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){
var MapOrSimilar = _dereq_('map-or-similar');

@@ -144,3 +256,3 @@

}
},{"map-or-similar":1}]},{},[2])(2)
},{"map-or-similar":1}]},{},[3])(3)
});

14

memoizerific.min.gzip.js

@@ -1,8 +0,6 @@

���JX�WM��6��W�>8$L���e�������0�L��H�BR�lm��EI�lm���� ����p<K+�X�$��(R4W���)��%Wi���J[�X�+y੐�0�u u�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�P K[����©�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 ��<��I�>Z��U�^�Y\��]�M_��Ў��&��04��-����H!H|C����c#-R��V��Py.=d�!����9|��Ԅ�,�g$�<'�ڵ�lOr ��[��^��p �[�=Ip$�J�(m����oIh2���=0��O̴�:В�Uu5� ��4�BXj/v`�?
@/P�$�����Ѧ�B7Ѕn� �?� �˥�
��΁X�V_��6�?8�X������4י�4�������8�D$����w���$m_@,���0���
U"�"C3��7O�R�Rq��k��5���.�<%����g����ؿ���Z�. ��^�I��2��wĊ=�G���E_�x��5�Ϣܫ���8��zdr�_W9 ���=b� CxT�B�o\�L�.��ACjp�%��Ds[�2���|()��d�b�v��ۓS#镜h����'��s�;{��+��eO+;��ZӒ?�Z+�f���T6���]��W��Z�^�pbs���:J������?�?�����޿���q�2�|�����i�v��R&%��r�1����-�z���>]���-nHFN�mF!wM��L�?� "q���/��*Qw&��|�y� ��qI\h�aoO�:��p�����N��yǪ��QZ4�~5����`ƕA4�jr��7͎�\�2 ��: ���R��3�� �E�}��DХ�ܘ���*�s��-=�O&�;u�y�)���I4�}�/Й�)� ��ԋA�}}����j3��C[�G�?��Hc���uҧ�;�.�����H\D!~�G!vSeS���-q���I*�j�OY񩔋�Wv��=���+���|�����~W+��iw..��`L%E�a�1 ���93߅`�‰�c�S�����]�4�Lʳt„�gi~en��)�n�80T��~�xl��9
���aWǩ���+YqV��>�
`�}}�y�Z�KKW�>����Q/zl_UJ� )�;�sxVO������u�ÑuJ��&���� l�6@?�E;���i�" ���$̇� �E�.b�����e��G�٧�4�Ǿ�z(*E܌�r����/�;b��%��9o�� H�.є/o�a��4H�1?�ڞ94�d_?X �%��ޓ?��s^��S�j���{�,�!X��
�0�`���_�6��1zv�q��m�Sp�.xi��\���њ��|j W��� Ģ�.��' �0m�3����5dtiy7�� ��䪖���g�b�G���{��� +x�9d' o!-��઺˓
p�n+�� ��%�x��� �n`�1 o$�mu'�A�kR�,�Қp���n0�ѹ�,d�;�_x-#VU���l��l�6��0����)|�(�.6 ��X�J(]�_�\O�\dp%�,zf��Ԟd���)ɚ>Nө��3 H��&]SAX�^��P����;d{���78���NTЮ

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

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.memoizerific=t()}}(function(){var t,e,i;return function t(e,i,r){function n(o,f){if(!i[o]){if(!e[o]){var a="function"==typeof require&&require;if(!f&&a)return a(o,!0);if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var l=i[o]={exports:{}};e[o][0].call(l.exports,function(t){var i=e[o][1][t];return n(i?i:t)},l,l.exports,t,e,i,r)}return i[o].exports}for(var s="function"==typeof require&&require,o=0;o<r.length;o++)n(r[o]);return n}({1:[function(e,i,r){!function(e){if("object"==typeof r&&"undefined"!=typeof i)i.exports=e();else if("function"==typeof t&&t.amd)t([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.mapOrSimilar=e()}}(function(){var t,i,r;return function t(i,r,n){function s(f,a){if(!r[f]){if(!i[f]){var u="function"==typeof e&&e;if(!a&&u)return u(f,!0);if(o)return o(f,!0);var l=new Error("Cannot find module '"+f+"'");throw l.code="MODULE_NOT_FOUND",l}var h=r[f]={exports:{}};i[f][0].call(h.exports,function(t){var e=i[f][1][t];return s(e?e:t)},h,h.exports,t,i,r,n)}return r[f].exports}for(var o="function"==typeof e&&e,f=0;f<n.length;f++)s(n[f]);return s}({1:[function(t,e,i){e.exports=function(e){if("function"!=typeof Map||e){var i=t("./similar");return new i}return new Map}},{"./similar":2}],2:[function(t,e,i){function r(){return this.list=[],this.lastItem=void 0,this.size=0,this}r.prototype.get=function(t){var e;return this.lastItem&&this.isEqual(this.lastItem.key,t)?this.lastItem.val:(e=this.indexOf(t),e>=0?(this.lastItem=this.list[e],this.list[e].val):void 0)},r.prototype.set=function(t,e){var i;return this.lastItem&&this.isEqual(this.lastItem.key,t)?(this.lastItem.val=e,this):(i=this.indexOf(t),i>=0?(this.lastItem=this.list[i],this.list[i].val=e,this):(this.lastItem={key:t,val:e},this.list.push(this.lastItem),this.size++,this))},r.prototype.delete=function(t){var e;if(this.lastItem&&this.isEqual(this.lastItem.key,t)&&(this.lastItem=void 0),e=this.indexOf(t),e>=0)return this.size--,this.list.splice(e,1)[0]},r.prototype.has=function(t){var e;return!(!this.lastItem||!this.isEqual(this.lastItem.key,t))||(e=this.indexOf(t),e>=0&&(this.lastItem=this.list[e],!0))},r.prototype.forEach=function(t,e){var i;for(i=0;i<this.size;i++)t.call(e||this,this.list[i].val,this.list[i].key,this)},r.prototype.indexOf=function(t){var e;for(e=0;e<this.size;e++)if(this.isEqual(this.list[e].key,t))return e;return-1},r.prototype.isEqual=function(t,e){return t===e||t!==t&&e!==e},e.exports=r},{}]},{},[1])(1)})},{}],2:[function(t,e,i){function r(t,e){var i=t.length,r=e.length,n,o,f;for(o=0;o<i;o++){for(n=!0,f=0;f<r;f++)if(!s(t[o][f].arg,e[f].arg)){n=!1;break}if(n)break}t.push(t.splice(o,1)[0])}function n(t){var e=t.length,i=t[e-1],r,n;for(i.cacheItem.delete(i.arg),n=e-2;n>=0&&(i=t[n],r=i.cacheItem.get(i.arg),!r||!r.size);n--)i.cacheItem.delete(i.arg)}function s(t,e){return t===e||t!==t&&e!==e}var o=t("map-or-similar");e.exports=function(t){var e=new o(!1),i=[];return function(s){var f=function(){var a=e,u,l,h=arguments.length-1,c=Array(h+1),p=!0,m;if((f.numArgs||0===f.numArgs)&&f.numArgs!==h+1)throw new Error("Memoizerific functions should always be called with the same number of arguments");for(m=0;m<h;m++)c[m]={cacheItem:a,arg:arguments[m]},a.has(arguments[m])?a=a.get(arguments[m]):(p=!1,u=new o(!1),a.set(arguments[m],u),a=u);return p&&(a.has(arguments[h])?l=a.get(arguments[h]):p=!1),p||(l=s.apply(null,arguments),a.set(arguments[h],l)),t>0&&(c[h]={cacheItem:a,arg:arguments[h]},p?r(i,c):i.push(c),i.length>t&&n(i.shift())),f.wasMemoized=p,f.numArgs=h+1,l};return f.limit=t,f.wasMemoized=!1,f.cache=e,f.lru=i,f}}},{"map-or-similar":1}]},{},[2])(2)});
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.memoizerific=t()}}(function(){var t,e,i;return function t(e,i,s){function r(o,a){if(!i[o]){if(!e[o]){var l="function"==typeof require&&require;if(!a&&l)return l(o,!0);if(n)return n(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var f=i[o]={exports:{}};e[o][0].call(f.exports,function(t){var i=e[o][1][t];return r(i?i:t)},f,f.exports,t,e,i,s)}return i[o].exports}for(var n="function"==typeof require&&require,o=0;o<s.length;o++)r(s[o]);return r}({1:[function(t,e,i){e.exports=function(e){if("function"!=typeof Map||e){var i=t("./similar");return new i}return new Map}},{"./similar":2}],2:[function(t,e,i){function s(){return this.list=[],this.lastItem=void 0,this.size=0,this}s.prototype.get=function(t){var e;return this.lastItem&&this.isEqual(this.lastItem.key,t)?this.lastItem.val:(e=this.indexOf(t),e>=0?(this.lastItem=this.list[e],this.list[e].val):void 0)},s.prototype.set=function(t,e){var i;return this.lastItem&&this.isEqual(this.lastItem.key,t)?(this.lastItem.val=e,this):(i=this.indexOf(t),i>=0?(this.lastItem=this.list[i],this.list[i].val=e,this):(this.lastItem={key:t,val:e},this.list.push(this.lastItem),this.size++,this))},s.prototype.delete=function(t){var e;if(this.lastItem&&this.isEqual(this.lastItem.key,t)&&(this.lastItem=void 0),e=this.indexOf(t),e>=0)return this.size--,this.list.splice(e,1)[0]},s.prototype.has=function(t){var e;return!(!this.lastItem||!this.isEqual(this.lastItem.key,t))||(e=this.indexOf(t),e>=0&&(this.lastItem=this.list[e],!0))},s.prototype.forEach=function(t,e){var i;for(i=0;i<this.size;i++)t.call(e||this,this.list[i].val,this.list[i].key,this)},s.prototype.indexOf=function(t){var e;for(e=0;e<this.size;e++)if(this.isEqual(this.list[e].key,t))return e;return-1},s.prototype.isEqual=function(t,e){return t===e||t!==t&&e!==e},e.exports=s},{}],3:[function(t,e,i){function s(t,e){var i=t.length,s=e.length,r,o,a;for(o=0;o<i;o++){for(r=!0,a=0;a<s;a++)if(!n(t[o][a].arg,e[a].arg)){r=!1;break}if(r)break}t.push(t.splice(o,1)[0])}function r(t){var e=t.length,i=t[e-1],s,r;for(i.cacheItem.delete(i.arg),r=e-2;r>=0&&(i=t[r],s=i.cacheItem.get(i.arg),!s||!s.size);r--)i.cacheItem.delete(i.arg)}function n(t,e){return t===e||t!==t&&e!==e}var o=t("map-or-similar");e.exports=function(t){var e=new o(!1),i=[];return function(n){var a=function(){var l=e,u,f,h=arguments.length-1,c=Array(h+1),m=!0,p;if((a.numArgs||0===a.numArgs)&&a.numArgs!==h+1)throw new Error("Memoizerific functions should always be called with the same number of arguments");for(p=0;p<h;p++)c[p]={cacheItem:l,arg:arguments[p]},l.has(arguments[p])?l=l.get(arguments[p]):(m=!1,u=new o(!1),l.set(arguments[p],u),l=u);return m&&(l.has(arguments[h])?f=l.get(arguments[h]):m=!1),m||(f=n.apply(null,arguments),l.set(arguments[h],f)),t>0&&(c[h]={cacheItem:l,arg:arguments[h]},m?s(i,c):i.push(c),i.length>t&&r(i.shift())),a.wasMemoized=m,a.numArgs=h+1,f};return a.limit=t,a.wasMemoized=!1,a.cache=e,a.lru=i,a}}},{"map-or-similar":1}]},{},[3])(3)});
{
"name": "memoizerific",
"version": "1.8.6",
"version": "1.9.0",
"description": "Fast, small, efficient JavaScript memoization lib to memoize JS functions",

@@ -26,7 +26,7 @@ "author": "Baz <baz@thinkloop.com>",

},
"main": "./memoizerific",
"main": "./src/memoizerific.js",
"scripts": {
"test": "echo '****************'`date +%r`'********************' && npm run -s test:map && npm run -s test:similar",
"build": "npm run -s build:all",
"publish_to_npm": "npm run -s build:all && git add --all && git commit -m \"build for publish\" && npm version patch && git push && git push --tags && npm publish",
"publish_to_npm": "npm version minor && git push && git push --tags && npm publish",
"_": "",

@@ -42,9 +42,9 @@ "test:map": "FORCE_SIMILAR_INSTEAD_OF_MAP=false JASMINE_CONFIG_PATH=./jasmine.json jasmine",

"dependencies": {
"map-or-similar": "^1.3.0"
"map-or-similar": "^1.4.0"
},
"devDependencies": {
"browserify": "13.1.1",
"derequire": "2.0.3",
"browserify": "13.3.0",
"derequire": "2.0.6",
"envify": "4.0.0",
"jasmine": "2.5.2",
"jasmine": "2.5.3",
"uglify-js": "2.7.5",

@@ -51,0 +51,0 @@ "watch": "1.0.1"

@@ -39,1 +39,2 @@ var Memoizerific = require('../src/memoizerific');

});

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