Skip to content

Commit

Permalink
Add exception testing to romanNumeralTranslator.js
Browse files Browse the repository at this point in the history
  • Loading branch information
fay-jai committed Jan 3, 2015
1 parent 70fde1f commit 4f9a48e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions romanNumeralTranslator/romanNumeralTranslator.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var translateRomanNumeral = function (romanNumeral) {
for (i = 0; i < len - 1; i += 1) {
current = DIGIT_VALUES[ romanNumeral[i] ];
next = DIGIT_VALUES[ romanNumeral[i + 1] ];
if ( current === void 0 || next === void 0 ) throw new Error('Invalid roman numeral characters');

result += (current >= next ? current : -current);
}
Expand Down

0 comments on commit 4f9a48e

Please sign in to comment.