import {Converter} from "./converter";

export class DecToHexConverter implements Converter {
    getDisplayname():string {
        return "Convert decimal to hexadecimal";
    }

    getId():string {
        return "dectohex";
    }

    convert(input:string):string {
        let n:number = parseInt(input, 10);
        if (isNaN(n)) {
            throw new Error("The input seems not to be a valid integer.");
        }
        return n.toString(16);
    }
}