@@ -55,14 +55,20 @@ Rserve.Robj = {
55
55
if ( _ . isUndefined ( this . attributes ) ) {
56
56
return values ;
57
57
} else {
58
- if ( this . attributes . value [ 0 ] . name != "names" )
59
- throw "expected names here" ;
60
- var keys = this . attributes . value [ 0 ] . value . value ;
61
- var result = { } ;
62
- _ . each ( keys , function ( key , i ) {
63
- result [ key ] = values [ i ] ;
64
- } ) ;
65
- return result ;
58
+ // FIXME: there is no reason why names should be the first or only
59
+ // attribute, so the code should really look
60
+ // for "names" and not cry if it doesn't exist
61
+ if ( this . attributes . value [ 0 ] . name == "names" ) {
62
+ var keys = this . attributes . value [ 0 ] . value . value ;
63
+ var result = { } ;
64
+ _ . each ( keys , function ( key , i ) {
65
+ result [ key ] = values [ i ] ;
66
+ } ) ;
67
+ return result ;
68
+ }
69
+ // FIXME: how can we pass other important attributes
70
+ // like "class" ?
71
+ return values ;
66
72
}
67
73
}
68
74
} ) ,
@@ -78,6 +84,11 @@ Rserve.Robj = {
78
84
if ( _ . isUndefined ( this . attributes ) ) {
79
85
return values ;
80
86
} else {
87
+ // FIXME: lang doens't have "names" attribute since
88
+ // names are sent as tags (langs are pairlists)
89
+ // so this seems superfluous (it is dangerous
90
+ // if lang ever had attributes since there is
91
+ // no reason to fail in that case)
81
92
if ( this . attributes . value [ 0 ] . name != "names" )
82
93
throw "expected names here" ;
83
94
var keys = this . attributes . value [ 0 ] . value . value ;
0 commit comments