Comparing version 2.0.2 to 2.0.3
@@ -200,8 +200,8 @@ 'use strict'; | ||
if ( !this._serviceQueues.hasOwnProperty( marshalledKey ) ) { | ||
this._serviceQueues[ marshalledKey ] = []; | ||
this._serviceQueues[marshalledKey] = []; | ||
} | ||
this._serviceQueues[ marshalledKey ].push( done ); | ||
this._serviceQueues[marshalledKey].push( done ); | ||
if ( this._serviceQueues[ marshalledKey ].length > 1 ) { | ||
if ( this._serviceQueues[marshalledKey].length > 1 ) { | ||
return; | ||
@@ -216,6 +216,6 @@ } | ||
async.whilst( | ||
() => !hasData && returnErr === null && currentIndex < this._getLayers.length, | ||
done => done( null, !hasData && returnErr === null && currentIndex < this._getLayers.length ), | ||
( done ) => { | ||
const handler = this._getLayers[ currentIndex ]; | ||
const handler = this._getLayers[currentIndex]; | ||
@@ -239,3 +239,3 @@ handler( key, ( err, data ) => { | ||
returnErr = new Error( 'layer ' + currentIndex + ' failed to return an instance of Error, returned: ' + | ||
__.getType( err ) ); | ||
__.getType( err ) ); | ||
@@ -262,4 +262,4 @@ } else { | ||
// they trigger another lookup on the same key | ||
const callbacks = this._serviceQueues[ marshalledKey ]; | ||
delete this._serviceQueues[ marshalledKey ]; | ||
const callbacks = this._serviceQueues[marshalledKey]; | ||
delete this._serviceQueues[marshalledKey]; | ||
@@ -303,3 +303,3 @@ // fire all callbacks synchronously, in series | ||
this._setLayers[ i ]( key, data, done ); | ||
this._setLayers[i]( key, data, done ); | ||
@@ -329,3 +329,3 @@ }, ( err ) => { | ||
async.applyEachSeries( this._setLayers, key, data, ( err ) => { | ||
async.applyEachSeries( this._setLayers, key, data )( err => { | ||
@@ -350,3 +350,3 @@ if ( err ) { | ||
async.applyEachSeries( this._clearLayers, key, ( err ) => { | ||
async.applyEachSeries( this._clearLayers, key )( ( err ) => { | ||
@@ -353,0 +353,0 @@ if ( err ) { |
@@ -7,2 +7,6 @@ 'use strict'; | ||
function hasOwn( obj, field ) { | ||
return Object.hasOwnProperty.call( obj, field ); | ||
} | ||
class Memory { | ||
@@ -44,4 +48,4 @@ | ||
if ( this._memoryCache.hasOwnProperty( key ) ) { | ||
return done( null, this._memoryCache[ key ] ); | ||
if ( hasOwn( this._memoryCache, key ) ) { | ||
return done( null, this._memoryCache[key] ); | ||
} | ||
@@ -62,5 +66,5 @@ | ||
( done ) => { | ||
this._memoryCache[ key ] = value; | ||
this._memoryCache[key] = value; | ||
setTimeout( () => { | ||
this._memoryCacheTimeouts[key] = setTimeout( () => { | ||
this._memoryClear( key, () => { | ||
@@ -78,12 +82,4 @@ // NO-OP | ||
clear( key, done ) { | ||
if ( this._memoryCacheTimeouts.hasOwnProperty( key ) ) { | ||
clearTimeout( this._memoryCacheTimeouts[ key ] ); | ||
} | ||
delete this._memoryCacheTimeouts[ key ]; | ||
delete this._memoryCache[ key ]; | ||
done(); | ||
key = util.marshallKey( key ); | ||
this._memoryClear( key, done ); | ||
} | ||
@@ -93,9 +89,10 @@ | ||
if ( this._memoryCacheTimeouts.hasOwnProperty( key ) ) { | ||
clearTimeout( this._memoryCacheTimeouts[ key ] ); | ||
if ( hasOwn( this._memoryCacheTimeouts, key ) ) { | ||
clearTimeout( this._memoryCacheTimeouts[key] ); | ||
} | ||
delete this._memoryCacheTimeouts[ key ]; | ||
delete this._memoryCache[ key ]; | ||
delete this._memoryCacheTimeouts[key]; | ||
delete this._memoryCache[key]; | ||
done(); | ||
@@ -102,0 +99,0 @@ |
{ | ||
"name": "asc", | ||
"description": "A middleware layer between a service and a client. The service could be an in-process library, a file, an external web service, anything. Any time the results from a resource call can be cached, you can use ASC as a proxy to that resource.", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"author": "Anthony Hildoer <anthony@bluerival.com>", | ||
@@ -15,10 +15,10 @@ "repository": { | ||
"dependencies": { | ||
"async": "2.6.2", | ||
"doublescore": "1.0.0" | ||
"async": "3.2.4", | ||
"doublescore": "1.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/mocha": "5.2.7", | ||
"eslint": "6.1.0", | ||
"glob": "7.1.4", | ||
"mocha": "6.2.0" | ||
"@types/mocha": "9.1.1", | ||
"eslint": "7.32.0", | ||
"glob": "8.0.3", | ||
"mocha": "9.2.2" | ||
}, | ||
@@ -25,0 +25,0 @@ "keywords": [ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
31156
370
+ Addedasync@3.2.4(transitive)
+ Addeddoublescore@1.0.1(transitive)
- Removedasync@2.6.2(transitive)
- Removeddoublescore@1.0.0(transitive)
- Removedlodash@4.17.21(transitive)
Updatedasync@3.2.4
Updateddoublescore@1.0.1