<commit_before>var url = require('url')

function copy (object, exclude) {
    var copy = {}
    for (var property in object) {
        if (property != exclude) {
            copy[property] = object[property]
        }
    }
    return copy
}

module.exports = function (base, vargs) {
    var merged = {}
    vargs.unshift(base)
    while (vargs.length != 0) {
        var varg = vargs.shift()
        if (Array.isArray(varg)) {
            vargs.unshift.apply(vargs, varg)
            continue
        }
        if (varg == null) {
            merged = {}
            continue
        }
        // If we have a UNIX domain socket, make it a base URL.
        if (varg.socketPath) {
            vargs.unshift(copy(varg, 'socketPath'))
            vargs.unshift({ url: 'http://' + encodeURIComponent(varg.socketPath) + '@unix'  })
            continue
        }
        // If we have a `path` property, make it follow any `url` property.
        if (varg.path) {
            vargs.unshift({ url: varg.path })
            vargs.unshift(copy(varg, 'path'))
            continue
        }
        for (var name in varg) {
            if (name == 'url') {
                if (merged.url == null) {
                    merged.url = varg.url
                } else {
                    merged.url = url.resolve(merged.url, varg.url)
                }
            } else if (name == 'headers') {
                if (merged.headers == null) {
                    merged.headers = {}
                }
                for (var header in varg.headers) {
                    if (varg.headers[header] == null) {
                        delete merged.headers[header]
                    } else {
                        merged.headers[header] = String(varg.headers[header])
                    }
                }
            } else if (name == 'gateways') {
                if (merged.gateways == null) {
                    merged.gateways = []
                }
                merged.gateways.unshift.apply(merged.gateways, varg.gateways)
                var index = merged.gateways.indexOf(null)
                if (~index) {
                    merged.gateways = merged.gateways.slice(0, index)
                }
            } else if (name == 'grant' && varg.grant == 'cc') {
                throw new Error('no more grant property')
            } else if (name == 'put' || name == 'post') {
                merged.payload = varg[name]
                merged.method = name.toUpperCase()
            } else if (name == 'body') {
                merged.payload = varg.body
            } else {
                merged[name] = varg[name]
            }
        }
    }
    return merged
}
<commit_msg>Covert if ladder to switch.<commit_after>var url = require('url')

function copy (object, exclude) {
    var copy = {}
    for (var property in object) {
        if (property != exclude) {
            copy[property] = object[property]
        }
    }
    return copy
}

module.exports = function (base, vargs) {
    var merged = {}
    vargs.unshift(base)
    while (vargs.length != 0) {
        var varg = vargs.shift()
        if (Array.isArray(varg)) {
            vargs.unshift.apply(vargs, varg)
            continue
        }
        if (varg == null) {
            merged = {}
            continue
        }
        // If we have a UNIX domain socket, make it a base URL.
        if (varg.socketPath) {
            vargs.unshift(copy(varg, 'socketPath'))
            vargs.unshift({ url: 'http://' + encodeURIComponent(varg.socketPath) + '@unix'  })
            continue
        }
        // If we have a `path` property, make it follow any `url` property.
        if (varg.path) {
            vargs.unshift({ url: varg.path })
            vargs.unshift(copy(varg, 'path'))
            continue
        }
        for (var name in varg) {
            switch (name) {
            case 'url':
                if (merged.url == null) {
                    merged.url = varg.url
                } else {
                    merged.url = url.resolve(merged.url, varg.url)
                }
                break
            case 'headers':
                if (merged.headers == null) {
                    merged.headers = {}
                }
                for (var header in varg.headers) {
                    if (varg.headers[header] == null) {
                        delete merged.headers[header]
                    } else {
                        merged.headers[header] = String(varg.headers[header])
                    }
                }
                break
            case 'gateways':
                if (merged.gateways == null) {
                    merged.gateways = []
                }
                merged.gateways.unshift.apply(merged.gateways, varg.gateways)
                var index = merged.gateways.indexOf(null)
                if (~index) {
                    merged.gateways = merged.gateways.slice(0, index)
                }
                break
            case 'grant':
                throw new Error('no more grant property')
                break
            case 'put':
            case 'post':
                merged.payload = varg[name]
                merged.method = name.toUpperCase()
                break
            case 'body':
                merged.payload = varg.body
                break
            default:
                merged[name] = varg[name]
                break
            }
        }
    }
    return merged
}

{'fraction_non_alphanumeric': 0.11143587869930581, 'fraction_numerical': 0.0007307270734380709, 'mean_word_length': 1.1614686142913542, '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': '4563407', 'n_tokens_mistral': 1531, 'n_tokens_neox': 1457, 'n_words': 350}