What Does The Adobe App Measurement Join Plugin Do?

The other day, I can across the “join Plugin” for Adobe App Measurement (likely Omniture when the plugin was released). Since the documentation is non-existent, I thought I would get out my archeology hat and do some excavation.

/*
 * Plugin: join
 */
var join = new Function("v", "p", ""
        + "var s = this;var f,b,d,w;if(p){f=p.front?p.front:'';b=p.back?p.back"
        + ":'';d=p.delim?p.delim:'';w=p.wrap?p.wrap:'';}var str='';for(var x=0"
        + ";x<v.length;x++){if(typeof(v[x])=='object' )str+=s.join( v[x],p);el"
        + "se str+=w+v[x]+w;if(x<v.length-1)str+=d;}return f+str+b;");

This function joins an Array of values (or a set of characters represented by a string) with a deliminator and wraps each value with a string. It then prepends a string to the front and back. Here are two examples:

var a = join([1,2,3], {
    front : 'front',
    back : 'back',
    delim : ',',
    wrap : 'wrap'
});
// frontwrap1wrap,wrap2wrap,wrap3wrapback
console.log(a);

var b = join('123', { 
    front : 'front',
    back : 'back',
    delim : ',',
    wrap : 'wrap'
});
// frontwrap1wrap,wrap2wrap,wrap3wrapback
console.log(b);

The function signature is essentially…

// (Array String || String)
// -> { front :: Optional String
//    , back :: Optional String
//    , delim :: Optional String
//    , wrap :: Optional String }
// -> String
function join(set, config) {
   // ...
}