编辑代码

var convert = {
    toInt(x) {
        return Number.parseInt(x);
    },

    toFloat(x) {
        return Number.parseFloat(x);
    },

    toBoolean(x) {
        if (x === 'false') {
            return false;
        }
        return Boolean(x);
    },

    toString(x) {
        return String(x);
    },

    changeRadix(x, radix) {
        return Number.radix(String(x), radix);
    }
};

module.exports = {
    convert
};