Skip to content

Commit

Permalink
Fix bug with Buffer objects now implemented as typed arrays in nodejs
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanHuguesRobert committed Mar 24, 2016
1 parent 83d3951 commit 56fdd60
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions lib/node_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,24 @@ function register_client_object( stage, object ){
var shallow_object = {}
var attr_name
var attr_value
for( attr_name in object ){
// Skip inherited members
if( !object.hasOwnProperty( attr_name ) )continue
// Skip private members
if( attr_name[ 0 ] === "_" )continue;
// Skip array indexes
if( "0123456789".indexOf( attr_name[ 0 ] ) !== -1 )continue;
attr_value = object[ attr_name ]
if( typeof attr_value !== "object" ){
if( typeof attr_value === "array" ){

}else{
shallow_object[ attr_name ] = attr_value
// Process typed array in a specific way, including Buffer objects
if( object.length !== undefined ){
shallow_object = { length: object.length };
}else{
for( attr_name in object ){
// Skip inherited members
if( !object.hasOwnProperty( attr_name ) )continue
// Skip private members
if( attr_name[ 0 ] === "_" )continue;
// Skip array indexes
if( "0123456789".indexOf( attr_name[ 0 ] ) !== -1 )continue;
attr_value = object[ attr_name ]
if( typeof attr_value !== "object" ){
if( typeof attr_value === "array" ){

}else{
shallow_object[ attr_name ] = attr_value
}
}
}
}
Expand Down

0 comments on commit 56fdd60

Please sign in to comment.