async-deco
Advanced tools
Comparing version 7.0.0 to 7.0.1
{ | ||
"name": "async-deco", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"description": "A collection of decorators for adding features to asynchronous functions (callback or promise based).", | ||
@@ -29,3 +29,3 @@ "main": "index.js", | ||
"mocha": "^2.1.0", | ||
"memoize-cache": "^3.2.4", | ||
"memoize-cache": "^3.3.1", | ||
"npm-release": "^1.0.0" | ||
@@ -32,0 +32,0 @@ }, |
@@ -14,2 +14,3 @@ var defaultLogger = require('../utils/default-logger'); | ||
cache.query(args, function (err, cacheQuery) { | ||
var key; | ||
if (err) { | ||
@@ -20,3 +21,3 @@ logger('cache-error', {cacheErr: err}); | ||
else if (cacheQuery.cached === true && !cacheQuery.stale) { | ||
logger('cache-hit', {key: cacheQuery.key, result: cacheQuery}); | ||
logger('cache-hit', {key: cacheQuery.key, result: cacheQuery, timing: cacheQuery.timing}); | ||
cb(null, cacheQuery.hit); | ||
@@ -28,7 +29,8 @@ } | ||
else { | ||
logger('cache-miss', {key: cacheQuery.key}); | ||
logger('cache-miss', {key: cacheQuery.key, timing: cacheQuery.timing}); | ||
args[args.length - 1] = function (err, res) { | ||
if (!err) { | ||
if (cache.push(args, res)) { | ||
logger('cache-set', {args: args, res: res}); | ||
key = cache.push(args, res); | ||
if (key) { | ||
logger('cache-set', {key: key, args: args, res: res}); | ||
} | ||
@@ -35,0 +37,0 @@ } |
@@ -21,3 +21,3 @@ var assert = require('chai').assert; | ||
setTimeout(function () { | ||
resolve(undefined, a); | ||
resolve(a); | ||
}, 0); | ||
@@ -68,3 +68,3 @@ }); | ||
setTimeout(function () { | ||
resolve(undefined, a); | ||
resolve(a); | ||
}, 0); | ||
@@ -71,0 +71,0 @@ }); |
@@ -81,3 +81,3 @@ var assert = require('chai').assert; | ||
func(5).then(function (err, value) { | ||
func(5).then(function (value) { | ||
assert.equal(value, 20); | ||
@@ -84,0 +84,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
135235
3650