Skip to content

Commit

Permalink
Set default value for options arguments
Browse files Browse the repository at this point in the history
Fixes: #91
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
  • Loading branch information
jviotti committed Oct 20, 2017
1 parent cae0bbc commit 50c0468
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ exports.get = function(key, options, callback) {
callback = options;
}

options = options || {};
callback = callback || _.noop;

async.waterfall([
Expand Down Expand Up @@ -183,6 +184,7 @@ exports.getMany = function(keys, options, callback) {
options = {};
}

options = options || {};
callback = callback || _.noop;

async.reduce(keys, {}, function(reducer, key, callback) {
Expand Down Expand Up @@ -222,6 +224,7 @@ exports.getAll = function(options, callback) {
options = {};
}

options = options || {};
callback = callback || _.noop;

async.waterfall([
Expand Down Expand Up @@ -262,6 +265,7 @@ exports.set = function(key, json, options, callback) {
callback = options;
}

options = options || {};
callback = callback || _.noop;

async.waterfall([
Expand Down Expand Up @@ -320,6 +324,7 @@ exports.has = function(key, options, callback) {
callback = options;
}

options = options || {};
callback = callback || _.noop;

async.waterfall([
Expand Down Expand Up @@ -368,6 +373,7 @@ exports.keys = function(options, callback) {
options = {};
}

options = options || {};
callback = callback || _.noop;

async.waterfall([
Expand Down Expand Up @@ -416,6 +422,7 @@ exports.remove = function(key, options, callback) {
callback = options;
}

options = options || {};
callback = callback || _.noop;

async.waterfall([
Expand Down Expand Up @@ -447,6 +454,7 @@ exports.clear = function(options, callback) {
callback = options;
}

options = options || {};
callback = callback || _.noop;

const userData = options.dataPath || exports.getDataPath();
Expand Down

0 comments on commit 50c0468

Please sign in to comment.