Skip to content

Commit

Permalink
Prevent cache keys from containing 'undefined'
Browse files Browse the repository at this point in the history
Line 12's options.data was more often than not `undefined`, so I prevented this by giving it an or-default '' value. It wasn't breaking anything, I just thought it was really ugly.
  • Loading branch information
basicallydan committed Feb 24, 2014
1 parent 75733a4 commit 2c4faa1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jquery-ajax-localstorage-cache.js
Expand Up @@ -9,7 +9,7 @@ $.ajaxPrefilter( function( options, originalOptions, jqXHR ) {
var hourstl = options.cacheTTL || 5;

var cacheKey = options.cacheKey ||
options.url.replace( /jQuery.*/,'' ) + options.type + options.data;
options.url.replace( /jQuery.*/,'' ) + options.type + (options.data || '');

// isCacheValid is a function to validate cache
if ( options.isCacheValid && ! options.isCacheValid() ){
Expand Down Expand Up @@ -60,4 +60,4 @@ $.ajaxPrefilter( function( options, originalOptions, jqXHR ) {
}

}
});
});

0 comments on commit 2c4faa1

Please sign in to comment.