function substringBefore(str, chars) {
        // undefined inputs always return undefined
        if (typeof str === 'undefined') {
            return undefined;
        }

        var pos = str.indexOf(chars);
        if (pos > -1) {
            return str.substr(0, pos);
        } else {
            return str;
        }
    }
Create substring up until a character
@param {String} str - String to evaluate
@param {String} chars - Character to define substring boundary
@returns {*} Substring