HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/komma.pro/resources/assets/js/site/helpers.js
/*
 * Simple isset method for this does not exist in javascript
 */
var isset = function(obj)
{
    return typeof obj !== 'undefined' && obj !== null;
};

/**
 * With this method you can call a function with it's string name
 * This will also work with namespaced functions
 * executeFunctionByName("My.Namespace.functionName", window, arguments);
 *
 * @param functionName
 * @param context
 * @returns {*}
 */
function executeFunctionByName(functionName, context /*, args */) {
    var args = [].slice.call(arguments).splice(2);
    // Split function name on .
    var namespaces = functionName.split(".");
    // Return last element of array and remove it
    var func = namespaces.pop();
    // Loop through every namespace
    for(var i = 0; i < namespaces.length; i++) {
        // Overwrite context with the namespace
        // We go one level deeper every time
        context = context[namespaces[i]];
    }
    // Finally call the function in the current context
    return context[func].apply(context, args);
}