Skip to content

Commit

Permalink
[fix] Correct parseInt defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
markbao committed Jan 24, 2016
1 parent f12bd0a commit f653975
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ exports.hotp.verifyDelta = function hotpVerifyDelta (options) {

// unpack options
var token = options.token;
var window = parseInt(options.window || 0, 10);
var counter = parseInt(options.counter || 0, 10);
var window = parseInt(options.window, 10) || 0;
var counter = parseInt(options.counter, 10) || 0;

// loop from C to C + W
for (i = counter; i <= counter + window; ++i) {
Expand Down Expand Up @@ -319,7 +319,7 @@ exports.totp.verifyDelta = function totpVerifyDelta (options) {
options = Object.create(options);

// unpack options
var window = parseInt(options.window || 0, 10);
var window = parseInt(options.window, 10) || 0;

// calculate default counter value
if (options.counter == null) options.counter = exports._counter(options);
Expand Down

0 comments on commit f653975

Please sign in to comment.