<commit_before>var calcMain = {
    calcObj : {
        srcNum: '0',
        destNum: '0',
        resultNum: '0',
        enterNum: '',
        btnFuncName: ''
    }
};
calcMain.fn = {};

calcMain.init = function(){
    var btnNums = document.getElementsByName('btn_num');

    for (var i = btnNums.length; i--;){
        btnNums[i].onclick = function(){
            calcMain.fn.clickBtnNum(this);
        }
    }

    document.getElementById('btn_func_plus').onclick = function() {
        calcMain.fn.plus();
    };

    document.getElementById('btn_func_equal').onclick = function(){
        calcMain.fn.equal();
    };
};

calcMain.fn.clickBtnNum = function(btnNumElement){
    var calcDisplay = document.getElementById('calcMain_display_div'),
        enterNum = calcMain.calcObj.enterNum;

    enterNum += btnNumElement.value;
    calcDisplay.innerHTML = enterNum;

    // set object
    calcMain.calcObj.enterNum = enterNum;
};

calcMain.fn.plus = function(){
    var srcNum = calcMain.calcObj.srcNum,
        destNum = calcMain.calcObj.destNum,
        enterNum = calcMain.calcObj.enterNum,
        resultNum = calcMain.calcObj.resultNum;

    calcMain.calcObj.btnFuncName = calcMain.fn.plus;

    if (enterNum == ''){
        resultNum = Number(srcNum) + Number(destNum);
        document.getElementById('calcMain_display_div').innerHTML = '' + resultNum;

    } else {
        destNum = enterNum;
        resultNum = Number(srcNum) + Number(destNum);

        calcMain.calcObj.srcNum = resultNum;
        calcMain.calcObj.destNum = '0';
        calcMain.calcObj.enterNum = '';
        calcMain.calcObj.resultNum = resultNum;
        document.getElementById('calcMain_display_div').innerHTML = '' + resultNum;
    }

    calcMain.fn.reloadSrcNum();
};

calcMain.fn.reloadSrcNum = function(){
    var calcDisplay = document.getElementById('calcMain_display_div'),
        calcDisplayValue = calcDisplay.innerHTML;

    calcDisplay.innerHTML = '&nbsp;';
    setTimeout(function () {
        calcDisplay.innerHTML = calcDisplayValue;
    }, 100);
};

calcMain.fn.equal = function(){
    calcMain.calcObj.btnFuncName();
};<commit_msg>feature(calc): Clear 구현<commit_after>var calcMain = {
    calcObj : {
        srcNum: '0',
        destNum: '0',
        resultNum: '0',
        enterNum: '',
        btnFuncName: ''
    }
};
calcMain.fn = {};

calcMain.init = function(){
    var btnNums = document.getElementsByName('btn_num');

    for (var i = btnNums.length; i--;){
        btnNums[i].onclick = function(){
            calcMain.fn.clickBtnNum(this);
        }
    }

    document.getElementById('btn_func_plus').onclick = function() {
        calcMain.fn.plus();
    };

    document.getElementById('btn_func_clear').onclick = function(){
        calcMain.fn.clear();
    };

    document.getElementById('btn_func_equal').onclick = function(){
        calcMain.fn.equal();
    };
};

calcMain.fn.clickBtnNum = function(btnNumElement){
    var calcDisplay = document.getElementById('calcMain_display_div'),
        enterNum = calcMain.calcObj.enterNum;

    enterNum += btnNumElement.value;
    calcDisplay.innerHTML = enterNum;

    // set object
    calcMain.calcObj.enterNum = enterNum;
};

calcMain.fn.plus = function(){
    var srcNum = calcMain.calcObj.srcNum,
        destNum = calcMain.calcObj.destNum,
        enterNum = calcMain.calcObj.enterNum,
        resultNum = calcMain.calcObj.resultNum;

    calcMain.calcObj.btnFuncName = calcMain.fn.plus;

    if (enterNum == ''){
        resultNum = Number(srcNum) + Number(destNum);
        document.getElementById('calcMain_display_div').innerHTML = '' + resultNum;

    } else {
        destNum = enterNum;
        resultNum = Number(srcNum) + Number(destNum);

        calcMain.calcObj.srcNum = resultNum;
        calcMain.calcObj.destNum = '0';
        calcMain.calcObj.enterNum = '';
        calcMain.calcObj.resultNum = resultNum;
        document.getElementById('calcMain_display_div').innerHTML = '' + resultNum;
    }

    calcMain.fn.reloadSrcNum();
};

calcMain.fn.reloadSrcNum = function(){
    var calcDisplay = document.getElementById('calcMain_display_div'),
        calcDisplayValue = calcDisplay.innerHTML;

    calcDisplay.innerHTML = '&nbsp;';
    setTimeout(function () {
        calcDisplay.innerHTML = calcDisplayValue;
    }, 100);
};

calcMain.fn.clear = function(){
    calcMain.calcObj.srcNum = '0';
    calcMain.calcObj.resultNum = '0';
    calcMain.calcObj.destNum = '0';
    calcMain.calcObj.enterNum = '';
    calcMain.calcObj.btnFuncName = '';

    document.getElementById('calcMain_display_div').innerHTML = calcMain.calcObj.resultNum;
};

calcMain.fn.equal = function(){
    calcMain.calcObj.btnFuncName();
};
{'fraction_non_alphanumeric': 0.13721325403568393, 'fraction_numerical': 0.003610875106202209, 'mean_word_length': 2.934001670843776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3904213', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1441, 'n_words': 213}