Skip to content

Commit

Permalink
Ignore missing else branches with istanbul
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkilgour committed Nov 13, 2015
1 parent 796ea60 commit 1e55cd6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/chancer.js
Expand Up @@ -66,6 +66,7 @@ function shuffleArray (obj) {
function shuffle (arr) {
for (var i = arr.length - 1; i >= 0; i--) {
var j = chancer.int(0, i);
/* istanbul ignore else */
if (j !== i) {
var tmp = arr[i];
arr[i] = arr[j];
Expand All @@ -81,6 +82,7 @@ function fillArray (min, max, total) {
if (typeof min === 'number' && typeof max === 'number') {
var num = (total) ? total : (max - min) + 1;
var arr;
/* istanbul ignore else */
if (typeof num === 'number' && (((max - min) + 1) >= num)) {
arr = generateArray(min, max, num);
}
Expand All @@ -96,11 +98,13 @@ function generateArray (min, max, total) {
var randomNumber = chancer.int(min, max);
var found = false;
for (var i = 0; i < arr.length; i++) {
/* istanbul ignore else */
if (arr[i] === randomNumber) {
found = true;
break;
}
}
/* istanbul ignore else */
if (!found) {
arr[arr.length] = randomNumber;
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/chancer.js
Expand Up @@ -43,7 +43,7 @@ describe('lib/chancer', function () {
assert.strictEqual(result, undefined);
});

it('should return `undefined` if no arguments are not numbers', function () {
it('should return `undefined` if neither argument are numbers', function () {
var result = chancer.float('zero', 'one');
assert.strictEqual(result, undefined);
});
Expand Down

0 comments on commit 1e55cd6

Please sign in to comment.