Может так доходчивей ?
socket.on('data', function (data) {
data.__sock = parseInt(data.__sock);
if(data.__sock > 0 && data.__sock !== userId) return;
for (f in data) {
if(f !== undefined && typeof window[f] == 'function') {
var func = window[f];func(data[f]); return;
}
if(f !== undefined && f.indexOf(".") != -1) {
var re = /([a-z]{1,})\.([a-z]{1,})/i;
found = f.match(re);
if(typeof window[found[1]] == 'object' && typeof window[found[1]][found[2]] == 'function') {
var func = window[found[1]][found[2]];
func(data[f]);
}
}
}
});