function parse_kwargs(kwargs)
{
    var args = new Object();
    var pairs = kwargs.split(/,/);
    for (var i = 0; i < pairs.length;) {
        if (i > 0 && pairs[i].indexOf('=') == -1) {
            // the value string contained a comma. Glue the parts back together.
            pairs[i-1] += ',' + pairs.splice(i, 1)[0];
        }
        else {
            ++i;
        }
    }
    for (var i = 0; i < pairs.length; ++i) {
        var splits = pairs[i].split(/=/);
        if (splits.length == 1) {
            continue;
        }
        var key = splits.shift();
        var value = splits.join('=');
        args[key.trim()] = value.trim();
    }
    return args;
}
function parse_kwargs(kwargs)
{
    var args = new Object();
    var pairs = kwargs.split(/,/);
    for (var i = 0; i < pairs.length;) {
        if (i > 0 && pairs[i].indexOf('=') == -1) {
            // the value string contained a comma. Glue the parts back together.
            pairs[i-1] += ',' + pairs.splice(i, 1)[0];
        }
        else {
            ++i;
        }
    }
    for (var i = 0; i < pairs.length; ++i) {
        var splits = pairs[i].split(/=/);
        if (splits.length == 1) {
            continue;
        }
        var key = splits.shift();
        var value = splits.join('=');
        args[key.trim()] = value.trim();
    }
    return args;
}
function parse_kwargs ( kwargs ) { var args = new Object ( ) ; var pairs = kwargs . split ( / , / ) ; for ( var i = 0 ; i < pairs . length ; ) { if ( i > 0 && pairs [ i ] . indexOf ( '=' ) == - 1 ) { // the value string contained a comma. Glue the parts back together. pairs [ i - 1 ] += ',' + pairs . splice ( i , 1 ) [ 0 ] ; } else { ++ i ; } } for ( var i = 0 ; i < pairs . length ; ++ i ) { var splits = pairs [ i ] . split ( / = / ) ; if ( splits . length == 1 ) { continue ; } var key = splits . shift ( ) ; var value = splits . join ( '=' ) ; args [ key . trim ( ) ] = value . trim ( ) ; } return args ; }
Parses a python-style keyword arguments string and returns the pairs in a
new object.

@param  kwargs  a string representing a set of keyword arguments. It should
look like <tt>keyword1=value1, keyword2=value2, ...</tt>
@return         an object mapping strings to strings
Parses a python - style keyword arguments string and returns the pairs in a new object .
Parse kwargs into a object