<commit_before>/** Mocking toggle */
const isMocking       = true
/** Simulate random failure */
const simulateFailure = false

/**
 * API URLs
 */

const apis =
{
    getCount: 'https://api.example.com/1.0/count'
}

/**
 * Mocking Function
 */

function mockingFn(data, callback, errCallback)
{
    result =
    {
        success : true,
        code    : "0000",
        message : "請求成功",
        data
    }

    /** Simulate random failure */
    if(Math.random() > 0.5 || navigator.userAgent.indexOf('PhantomJS') > -1 || !simulateFailure)
        callback(result)
    else
        errCallback(result)
}

/**
 * Export
 */

module.exports = {isMocking, apis, mockingFn}<commit_msg>Fixed the mocking callback<commit_after>/** Mocking toggle */
const isMocking       = true
/** Simulate random failure */
const simulateFailure = false

/**
 * API URLs
 */

const apis =
{
    getCount: 'https://api.example.com/1.0/count'
}

/**
 * Mocking Function
 */

function mockingFn(data, callback, errCallback)
{
    /** Simulate random failure */
    if(Math.random() > 0.5 || navigator.userAgent.indexOf('PhantomJS') > -1 || !simulateFailure)
        callback({
            //url       :
            body      : data,
            //headers   :
            ok        : true,
            status    : 200,
            statusText: "Success"
        })
    else
        errCallback({
            //url       :
            body      : data,
            //headers   :
            ok        : false,
            status    : 400,
            statusText: "Bad Request"
        })
}

/**
 * Export
 */

module.exports = {isMocking, apis, mockingFn}
{'fraction_non_alphanumeric': 0.1367259350091968, 'fraction_numerical': 0.012262415695892091, 'mean_word_length': 1.7521079258010117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '3996104', 'n_tokens_mistral': 517, 'n_tokens_neox': 492, 'n_words': 111}