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

memoizee

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memoizee - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

22

index.js

@@ -12,14 +12,14 @@ 'use strict';

length = options.length = resolveLength(options.length, fn.length, options.async);
if (length === 0) {
options.normalizer = require('./normalizers/0');
} else if (options.primitive) {
if (length === false) {
options.normalizer = require('./normalizers/primitive');
} else if (length > 1) {
options.normalizer = require('./normalizers/get-primitive-fixed')(length);
if (length !== 0) {
if (options.primitive) {
if (length === false) {
options.normalizer = require('./normalizers/primitive');
} else if (length > 1) {
options.normalizer = require('./normalizers/get-primitive-fixed')(length);
}
} else {
if (length === false) options.normalizer = require('./normalizers/get')();
else if (length === 1) options.normalizer = require('./normalizers/get-1')();
else options.normalizer = require('./normalizers/get-fixed')(length);
}
} else {
if (length === false) options.normalizer = require('./normalizers/get')();
else if (length === 1) options.normalizer = require('./normalizers/get-1')();
else options.normalizer = require('./normalizers/get-fixed')(length);
}

@@ -26,0 +26,0 @@ }

@@ -23,3 +23,3 @@ 'use strict';

module.exports = function (original, length, options) {
var cache = create(null), conf, memLength, get, set, del, clear
var cache = create(null), conf, memLength, get, set, del, clear, extDel
, getListeners, setListeners, deleteListeners, memoized, resolve, resolvers;

@@ -77,2 +77,18 @@ if (length !== false) memLength = length;

}, memLength);
} else if (length === 0) {
memoized = function () {
var result;
if (hasOwnProperty.call(cache, 'data')) {
if (getListeners) conf.emit('get', 'data', arguments, this);
return cache.data;
}
if (!arguments.length) result = call.call(original, this);
else result = apply.call(original, this, arguments);
if (hasOwnProperty.call(cache, 'data')) {
throw customError("Circular invocation", 'CIRCULAR_INVOCATION');
}
cache.data = result;
if (setListeners) conf.emit('set', 'data');
return result;
};
} else {

@@ -131,5 +147,4 @@ memoized = function (arg) {

};
defineProperties(memoized, {
__memoized__: d(true),
delete: d(get ? defineLength(function (arg) {
if (get) {
extDel = defineLength(function (arg) {
var id, args = arguments;

@@ -140,6 +155,14 @@ if (resolve) args = resolve(args);

conf.delete(id);
}, memLength) : function (arg) {
}, memLength);
} else if (length === 0) {
extDel = function () { return conf.delete('data'); };
} else {
extDel = function (arg) {
if (resolve) arg = resolve(arguments)[0];
return conf.delete(arg);
}),
};
}
defineProperties(memoized, {
__memoized__: d(true),
delete: d(extDel),
clear: d(conf.clear)

@@ -146,0 +169,0 @@ });

{
"name": "memoizee",
"version": "0.3.1",
"version": "0.3.2",
"description": "Memoize/cache",

@@ -28,3 +28,3 @@ "author": "Mariusz Nowak <medikoo@medikoo.com> (http://www.medikoo.com/)",

"d": "~0.1.1",
"es5-ext": "~0.10.2",
"es5-ext": "~0.10.4",
"event-emitter": "~0.3.1",

@@ -31,0 +31,0 @@ "lru-queue": "0.1.x",

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

// To be used internally, memoize factory
'use strict';

@@ -4,0 +2,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