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.4.1 to 0.4.2

9

ext/promise.js

@@ -16,2 +16,4 @@ // Support for functions returning promise

conf.on('set', function (id, ignore, promise) {
var isFailed = false;
if (!isPromise(promise)) {

@@ -27,2 +29,8 @@ // Non promise result

var count = waiting[id];
if (isFailed) {
throw new Error("Memoizee error: Promise resolved with both failure and success," +
" this can be result of unordered done & finally resolution.\n" +
"Instead of `promise: true` consider configuring memoization via `promise: 'then'` or " +
"`promise: 'done'");
}
if (!count) return; // deleted from cache before resolved

@@ -34,2 +42,3 @@ delete waiting[id];

var onFailure = function () {
isFailed = true;
if (!waiting[id]) return; // deleted from cache (or succeed in case of finally)

@@ -36,0 +45,0 @@ delete waiting[id];

11

package.json
{
"name": "memoizee",
"version": "0.4.1",
"version": "0.4.2",
"description": "Memoize/cache function results",

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

"plain-promise": "^0.1.1",
"tad": "^0.2.4",
"tad": "^0.2.7",
"xlint": "^0.2.2",

@@ -45,7 +45,8 @@ "xlint-jslint-medikoo": "^0.1.4"

"scripts": {
"lint": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream",
"lint-console": "node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch",
"test": "node node_modules/tad/bin/tad"
"lint": "npm run lint-medikoo -- --no-cache --no-stream",
"lint-console": "npm run lint-medikoo -- --watch",
"lint-medikoo": "xlint --linter=node_modules/xlint-jslint-medikoo/index.js",
"test": "tad"
},
"license": "MIT"
}

@@ -16,3 +16,3 @@ # Memoizee

* [__WeakMap based mode__](#weakmap-based-configurations) for garbage collection friendly configuration
* Can be configured [__for methods__](#memoizing-a-method) (when `this` counts in)
* Can be configured [__for methods__](#memoizing-methods) (when `this` counts in)
* Cache [__can be cleared manually__](#manual-clean-up) or [__after specified timeout__](#expire-cache-after-given-period-of-time)

@@ -106,3 +106,3 @@ * Cache size can be __[limited on LRU basis](#limiting-cache-size)__

```javascript
var mFn = memoize(function (hash) {
var mfn = memoize(function (hash) {
// body of memoized function

@@ -331,4 +331,7 @@ }, { normalizer: function (args) {

With _max_ option you can limit cache size, it's backed with [LRU algorithm](http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used), provided by low-level [lru-queue](https://github.com/medikoo/lru-queue) utility
With _max_ option you can limit cache size, it's backed with [LRU algorithm](http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used), provided by low-level [lru-queue](https://github.com/medikoo/lru-queue) utility.
The _size_ relates purely to count of results we want to keep in cache, it doesn't relate to memory cost assiociated with cache value (but such feature is likely to be introduced with next version of memoizee).
```javascript

@@ -335,0 +338,0 @@ memoized = memoize(fn, { max: 2 });

Sorry, the diff of this file is not supported yet

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