Skip to content

Commit

Permalink
Simplify checkArrayTypes, add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
dchest committed Nov 2, 2014
1 parent b47750a commit 1c64578
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 9 deletions.
6 changes: 3 additions & 3 deletions nacl-fast.js
Original file line number Diff line number Diff line change
Expand Up @@ -2148,9 +2148,9 @@ function checkBoxLengths(pk, sk) {
}

function checkArrayTypes() {
var type = {}.toString, t;
for (var i = 0; i < arguments.length; i++) {
if ((t = type.call(arguments[i])) !== '[object Uint8Array]')
var t, i;
for (i = 0; i < arguments.length; i++) {
if ((t = Object.prototype.toString.call(arguments[i])) !== '[object Uint8Array]')
throw new TypeError('unexpected type ' + t + ', use Uint8Array');
}
}
Expand Down
4 changes: 2 additions & 2 deletions nacl-fast.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions nacl.js
Original file line number Diff line number Diff line change
Expand Up @@ -935,9 +935,9 @@ function checkBoxLengths(pk, sk) {
}

function checkArrayTypes() {
var type = {}.toString, t;
for (var i = 0; i < arguments.length; i++) {
if ((t = type.call(arguments[i])) !== '[object Uint8Array]')
var t, i;
for (i = 0; i < arguments.length; i++) {
if ((t = Object.prototype.toString.call(arguments[i])) !== '[object Uint8Array]')
throw new TypeError('unexpected type ' + t + ', use Uint8Array');
}
}
Expand Down
Loading

0 comments on commit 1c64578

Please sign in to comment.