var global = sn_util_getGlobalObject();

function sn_util_getGlobalObject() {
    // Workers don’t have `window`, only `self`
    if (typeof self !== 'undefined') {
        return self;
    }
    if (typeof global !== 'undefined') {
        return global;
    }
    // Not all environments allow eval and Function
    // Use only as a last resort:
    return new Function('return this')();
}

var global = (function() {
    // Workers don’t have `window`, only `self`
    if (typeof self !== 'undefined') {
        return self;
    }
    if (typeof global !== 'undefined') {
        return global;
    }
    // Not all environments allow eval and Function
    // Use only as a last resort:
    return new Function('return this')();
}());

Split out function.