diff --git a/lib/secure-random-string.js b/lib/secure-random-string.js index 876563e..6f0e6c3 100644 --- a/lib/secure-random-string.js +++ b/lib/secure-random-string.js @@ -12,12 +12,10 @@ function srs(options, cb) { // async path if (cb) { crypto.randomBytes(length, function(err, buf) { - if (err) { - return cb(err) - } - else { - return cb(null,_finish(buf)); - } + if (err) { + return cb(err); + } + return cb(null,_finish(buf)); }); } // sync path diff --git a/tests.js b/tests.js index b8a5520..25dbd96 100644 --- a/tests.js +++ b/tests.js @@ -29,28 +29,28 @@ var test = function(name, what, ref, c) { // async tests -srs(function(err,sr) { +srs(function(err, sr) { test('generate a random string 32 chars long', sr.length, 32 ); }); -srs({length: 1}, function(err,sr) { +srs({length: 1}, function(err, sr) { test('generate a random string 1 char long', sr.length, 1 ); }); -srs({length: 256}, function(err,sr) { +srs({length: 256}, function(err, sr) { test('generate a random string 256 chars long', sr.length, 256 ); }); -srs({length: 256, urlsafe: true}, function(err,sr) { +srs({length: 256, urlsafe: true}, function(err, sr) { test('generate a urlsafe random string 256 chars long', sr.length, 256