msl-client-browser/appcontainer-driver.js
function escapeString(str) {

    if(str === undefined) {
        throw new Error('\'str\' is required');
    }

    if(str === null) {
        throw new Error('\'str\' must not be null');
    }

    if(typeof str !== 'string') {
        throw new Error('\'str\' must be a string');
    }

    /*
     * Need to escape backslashes (\) first because escaping ' and " will also 
     * add a \, which interferes with \ escaping.
     */
    var escaped_str = str;
    // regex replace all \ to \\
    escaped_str = escaped_str.replace(/\\/g, '\\\\');
    // regex replace all ' to \'
    escaped_str = escaped_str.replace(/'/g, '\\\'');
    // regex replace all " to \"
    escaped_str = escaped_str.replace(/"/g, '\\"');

    return escaped_str;

}
function escapeString(str) {

    if(str === undefined) {
        throw new Error('\'str\' is required');
    }

    if(str === null) {
        throw new Error('\'str\' must not be null');
    }

    if(typeof str !== 'string') {
        throw new Error('\'str\' must be a string');
    }

    /*
     * Need to escape backslashes (\) first because escaping ' and " will also 
     * add a \, which interferes with \ escaping.
     */
    var escaped_str = str;
    // regex replace all \ to \\
    escaped_str = escaped_str.replace(/\\/g, '\\\\');
    // regex replace all ' to \'
    escaped_str = escaped_str.replace(/'/g, '\\\'');
    // regex replace all " to \"
    escaped_str = escaped_str.replace(/"/g, '\\"');

    return escaped_str;

}
function escapeString ( str ) { if ( str === undefined ) { throw new Error ( '\'str\' is required' ) ; } if ( str === null ) { throw new Error ( '\'str\' must not be null' ) ; } if ( typeof str !== 'string' ) { throw new Error ( '\'str\' must be a string' ) ; } /*
     * Need to escape backslashes (\) first because escaping ' and " will also 
     * add a \, which interferes with \ escaping.
     */ var escaped_str = str ; // regex replace all \ to \\ escaped_str = escaped_str . replace ( / \\ / g , '\\\\' ) ; // regex replace all ' to \' escaped_str = escaped_str . replace ( / ' / g , '\\\'' ) ; // regex replace all " to \" escaped_str = escaped_str . replace ( / " / g , '\\"' ) ; return escaped_str ; }
Escapes single, double quotes, and backslashes of the given string.
@name escapeString
@param {string} str - string to escape
@returns {string} the escaped string
Escapes single double quotes and backslashes of the given string .