Socket
Socket
Sign inDemoInstall

memoizerific

Package Overview
Dependencies
1
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.8.3 to 1.8.4

tests/differing-num-args.js

8

memoizerific.js

@@ -129,2 +129,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 ((memoizerific.numArgs || memoizerific.numArgs === 0) && memoizerific.numArgs !== argsLengthMinusOne + 1) {
throw new Error('Memoizerific functions should always be called with the same number of arguments');
}
// loop through each argument to traverse the map tree

@@ -137,3 +141,4 @@ for (i = 0; i < argsLengthMinusOne; i++) {

// if all arguments exist in map tree, the memoized result will be last value to be retrieved
// 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 (currentCache.has(arguments[i])) {

@@ -186,2 +191,3 @@ currentCache = currentCache.get(arguments[i]);

memoizerific.wasMemoized = isMemoized;
memoizerific.numArgs = argsLengthMinusOne + 1;

@@ -188,0 +194,0 @@ return fnResult;

10

memoizerific.min.gzip.js

@@ -1,6 +0,4 @@

���=W�VQo�6~߯����0��ɛT�� (�4C�>B��TĕU�J����;��e�^6}������ҪH ��oЖ��X>��3&ļ�L�#������d\��m�^���M%r��U%�G�����~o�Y�L�7�������qG�OT�X��9�ϼ������4�|�b�>g54����&�� g��?��)O,�����AM83�#�L��Q�72>H�F۽D��&�_�حX��f9�žU\AR�Ed���D�֟��Yy�ɊVf�f�`ϣk����Т�f�7m�Fo�S9���dJ>�� �H����/��?����y���1�jk/%6v�mkn�:���8H�~ڕ2��Q\�kw�R>_�Р��?�drW�Z�e�Y��Ě+�O��$�H�Ձ`ţ�"9�"�k��}��]��>Z�m{�{n��r�+�L�޷��O�FU � ���������_��>��y���������\P5Fa�Nj�=� /�_����X,g��!�e�?T�����I��h�Mܺ��l��<2C��Ƣ����d�����[E�?� �����P� �3�A�}�M�fK2_ ϓ=�5�P�?�
��a�z:f-�~:x�$zšXP���U���Ɔ���>4�&������t6TE})�Sg�(%&�a������RP�תj����R���t\ ]9��gT�B"z�b���[%��5M��\���ü�o��#Ǹ��v��N9��P��l�9��~&+�+ts��%�gR�6��Lwat��-����G`�2����<�� �0��c� ��WW�<b��5a�Ra�1�v��l���
�昂T/iD\\���U��� !o=(F�֠��[vm�QR�����.�}|��1�X��Cy��5�s="�+�f��A��s
N�C}�����w;���� ���>���� ^��&��L���ʉ�R�p�y3H@����5��ht(9zّ��-^��Ya�Kw�� �R����t�piK�7�ˡ��2�r(`���]��
�½1ح����?��� �I�@��e������@g ��_%T��z��� �q���))Z���/*ф��Љ�*�)����dH��k`+[���q�B�x��=Ӧt ����O�M
fi�L��{�nH�ӺCF��sn�9ҁ�P�0�(��pL�ھ>��.�ض3^_�ȿD5�~��wȖ!
��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��

@@ -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,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 h=new Error("Cannot find module '"+o+"'");throw h.code="MODULE_NOT_FOUND",h}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){"function"!=typeof Map||process&&process.env&&"true"===process.env.TEST_MAPORSIMILAR?e.exports=t("./similar"):e.exports=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;return this.lastItem&&this.isEqual(this.lastItem.key,t)&&(this.lastItem=void 0),e=this.indexOf(t),e>=0?(this.size--,this.list.splice(e,1)[0]):void 0},s.prototype.has=function(t){var e;return this.lastItem&&this.isEqual(this.lastItem.key,t)?!0:(e=this.indexOf(t),e>=0?(this.lastItem=this.list[e],!0):!1)},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;i>o;o++){for(r=!0,a=0;s>a;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,i=[];return function(n){var a=function(){var l=e,h,f,u=arguments.length-1,c=Array(u+1),p=!0,m;for(m=0;u>m;m++)c[m]={cacheItem:l,arg:arguments[m]},l.has(arguments[m])?l=l.get(arguments[m]):(p=!1,h=new o,l.set(arguments[m],h),l=h);return p&&(l.has(arguments[u])?f=l.get(arguments[u]):p=!1),p||(f=n.apply(null,arguments),l.set(arguments[u],f)),t>0&&(c[u]={cacheItem:l,arg:arguments[u]},p?s(i,c):i.push(c),i.length>t&&r(i.shift())),a.wasMemoized=p,f};return a.limit=t,a.wasMemoized=!1,a.cache=e,a.lru=i,a}}},{"map-or-similar":1}]},{},[3])(3)});
!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 h=i[o]={exports:{}};e[o][0].call(h.exports,function(t){var i=e[o][1][t];return r(i?i:t)},h,h.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){"function"!=typeof Map||process&&process.env&&"true"===process.env.TEST_MAPORSIMILAR?e.exports=t("./similar"):e.exports=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;return this.lastItem&&this.isEqual(this.lastItem.key,t)&&(this.lastItem=void 0),e=this.indexOf(t),e>=0?(this.size--,this.list.splice(e,1)[0]):void 0},s.prototype.has=function(t){var e;return this.lastItem&&this.isEqual(this.lastItem.key,t)?!0:(e=this.indexOf(t),e>=0?(this.lastItem=this.list[e],!0):!1)},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;i>o;o++){for(r=!0,a=0;s>a;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,i=[];return function(n){var a=function(){var l=e,u,h,f=arguments.length-1,c=Array(f+1),p=!0,m;if((a.numArgs||0===a.numArgs)&&a.numArgs!==f+1)throw new Error("Memoizerific functions should always be called with the same number of arguments");for(m=0;f>m;m++)c[m]={cacheItem:l,arg:arguments[m]},l.has(arguments[m])?l=l.get(arguments[m]):(p=!1,u=new o,l.set(arguments[m],u),l=u);return p&&(l.has(arguments[f])?h=l.get(arguments[f]):p=!1),p||(h=n.apply(null,arguments),l.set(arguments[f],h)),t>0&&(c[f]={cacheItem:l,arg:arguments[f]},p?s(i,c):i.push(c),i.length>t&&r(i.shift())),a.wasMemoized=p,a.numArgs=f+1,h};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.3",
"version": "1.8.4",
"description": "Fast, small, most-efficient JavaScript memoization lib to memoize JS functions",

@@ -18,9 +18,9 @@ "author": "@thinkloop",

"test": "npm run -s test:map && npm run -s test:similar",
"build": "npm run -s build:browserify | tee memoizerific.js | npm run -s build:minify | tee memoizerific.min.js | npm run -s build:gzip > memoizerific.min.gzip.js",
"publish_to_npm": "npm run build && git add --all && git commit -m \"build for publish\" && npm version patch && git push && git push --tags && npm publish",
"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",
"_": "",
"test:map": "TEST_MAPORSIMILAR=false JASMINE_CONFIG_PATH=jasmine.json jasmine",
"test:similar": "TEST_MAPORSIMILAR=true JASMINE_CONFIG_PATH=jasmine.json jasmine",
"test:map": "TEST_MAPORSIMILAR=false JASMINE_CONFIG_PATH=./jasmine.json jasmine",
"test:similar": "TEST_MAPORSIMILAR=true JASMINE_CONFIG_PATH=./jasmine.json jasmine",
"__": "",
"prebuild": "npm run -s test",
"prebuild:all": "npm run -s test",
"build:all": "npm run -s build:browserify | tee memoizerific.js | npm run -s build:minify | tee memoizerific.min.js | npm run -s build:gzip > memoizerific.min.gzip.js",
"build:browserify": "browserify src/memoizerific.js --detectGlobals false --standalone memoizerific | derequire",

@@ -48,3 +48,3 @@ "build:minify": "uglifyjs --compress drop_console,unused=false --mangle --screw-ie8",

"jasmine": "^2.4.1",
"npm-check-updates": "^2.6.5",
"npm-check-updates": "^2.6.7",
"uglify-js": "^2.6.2",

@@ -51,0 +51,0 @@ "watch": "^0.18.0"

@@ -17,2 +17,6 @@ var MapOrSimilar = require('map-or-similar');

if ((memoizerific.numArgs || memoizerific.numArgs === 0) && memoizerific.numArgs !== argsLengthMinusOne + 1) {
throw new Error('Memoizerific functions should always be called with the same number of arguments');
}
// loop through each argument to traverse the map tree

@@ -25,3 +29,4 @@ for (i = 0; i < argsLengthMinusOne; i++) {

// if all arguments exist in map tree, the memoized result will be last value to be retrieved
// 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 (currentCache.has(arguments[i])) {

@@ -74,2 +79,3 @@ currentCache = currentCache.get(arguments[i]);

memoizerific.wasMemoized = isMemoized;
memoizerific.numArgs = argsLengthMinusOne + 1;

@@ -76,0 +82,0 @@ return fnResult;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc