File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -327,17 +327,27 @@ function redisStore(args) {
327327 /**
328328 * Returns all keys matching pattern using the SCAN command.
329329 * @method keys
330- * @param {String } pattern - The pattern used to match keys
331- * @param {Object } [options] - The options (optional )
330+ * @param {String } [ pattern] - The pattern used to match keys (default: *)
331+ * @param {Object } [options] - The options (default: {} )
332332 * @param {number } [options.scanCount] - The number of keys to traverse with each call to SCAN (default: 100)
333333 * @param {Function } cb - A callback that returns a potential error and the response
334334 */
335335 self . keys = function ( pattern , options , cb ) {
336+
337+ // Account for all argument permutations.
338+ // Only cb supplied.
336339 if ( typeof pattern === 'function' ) {
337340 cb = pattern ;
338- pattern = '*' ;
339341 options = { } ;
342+ pattern = '*' ;
343+ }
344+ // options and cb supplied.
345+ else if ( typeof pattern === 'object' ) {
346+ cb = options ;
347+ options = pattern ;
348+ pattern = '*' ;
340349 }
350+ // pattern and cb supplied.
341351 else if ( typeof options === 'function' ) {
342352 cb = options ;
343353 options = { } ;
You can’t perform that action at this time.
0 commit comments