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

async-deco

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-deco - npm Package Compare versions

Comparing version 5.0.1 to 5.0.2

2

package.json
{
"name": "async-deco",
"version": "5.0.1",
"version": "5.0.2",
"description": "A collection of decorators for adding features to asynchronous functions (callback or promise based).",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -176,2 +176,3 @@ async-deco

* "cache-miss" (when the item is not in the cache) with {key: cache key}
* "cache-set" with {args: arguments for caching, res: result to cache}

@@ -248,2 +249,3 @@ Proxy

* "fallback-cache-miss" with {key: cache key, actualResult: {err: error returned, res: result returned}}
* "fallback-cache-set" with {args: arguments for caching, res: result to cache}

@@ -250,0 +252,0 @@ Timeout

@@ -26,2 +26,3 @@ var defaultLogger = require('../utils/default-logger');

if (!err) {
logger('cache-set', {args: args, res: res});
cache.push(args, res);

@@ -28,0 +29,0 @@ }

@@ -11,3 +11,3 @@ var defaultLogger = require('../utils/default-logger');

if (error === Error || Error.isPrototypeOf(error)) {
condition = function (err, dep) { return err instanceof error; };
condition = function (err, res) { return err instanceof error; };
}

@@ -25,17 +25,17 @@ else {

args[args.length - 1] = function (err, dep) {
if (condition(err, dep)) {
args[args.length - 1] = function (err, res) {
if (condition(err, res)) {
cache.query(args, function (e, cacheQuery) {
if (e) {
logger('fallback-cache-error', {err: err, cacheErr: e});
cb(err, dep);
cb(err, res);
}
else if (cacheQuery.cached === true &&
(!cacheQuery.stale || (useStale && cacheQuery.stale))) {
logger('fallback-cache-hit', {key: cacheQuery.key, result: cacheQuery, actualResult: {err: err, res: dep}});
logger('fallback-cache-hit', {key: cacheQuery.key, result: cacheQuery, actualResult: {err: err, res: res}});
cb(null, cacheQuery.hit);
}
else {
logger('fallback-cache-miss', {key: cacheQuery.key, actualResult: {err: err, res: dep}});
cb(err, dep);
logger('fallback-cache-miss', {key: cacheQuery.key, actualResult: {err: err, res: res}});
cb(err, res);
}

@@ -45,4 +45,8 @@ });

else {
!noPush && cache.push(args, dep);
cb(null, dep);
if (!noPush) {
logger('fallback-cache-set', {args: args, res: res});
cache.push(args, res);
}
cb(null, res);
}

@@ -49,0 +53,0 @@ };

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