21 lines
629 B
JavaScript
21 lines
629 B
JavaScript
"use strict";
|
|
var DecToHexConverter = (function () {
|
|
function DecToHexConverter() {
|
|
}
|
|
DecToHexConverter.prototype.getDisplayname = function () {
|
|
return "Convert decimal to hexadecimal";
|
|
};
|
|
DecToHexConverter.prototype.getId = function () {
|
|
return "dectohex";
|
|
};
|
|
DecToHexConverter.prototype.convert = function (input) {
|
|
var n = parseInt(input, 10);
|
|
if (isNaN(n)) {
|
|
throw new Error("The input seems not to be a valid integer.");
|
|
}
|
|
return n.toString(16);
|
|
};
|
|
return DecToHexConverter;
|
|
}());
|
|
exports.DecToHexConverter = DecToHexConverter;
|