encoder.js
function encodePlainObject( encoder, object ) {

	// Extract plain object signature
	var o_keys =Object.keys(object);
		// signature = o_keys.join("+"),
	var sid = encoder.getSignatureID( o_keys );

	// Collect values of all properties
	var values = [];
	for (var i=0, len=o_keys.length; i<len; ++i)
		values.push( object[o_keys[i]] );

	encoder.log(LOG.PLO, "plain["+sid+"], signature="+o_keys.toString()+", sid="+sid);

	// Split entity ID in a 11-bit number
	var sid_hi = (sid & 0x700) >> 8,
		sid_lo =  sid & 0xFF;

	// We have a known entity ID, re-use it
	encoder.stream8.write( pack1b( PRIM_OP.OBJECT | OBJ_OP.PLAIN_LOOKUP | sid_hi ) );
	encoder.stream8.write( pack1b( sid_lo ) );
	encoder.counters.op_prm+=2;

	// Keep iref and encode
	encodeArray( encoder, values );

}
function encodePlainObject( encoder, object ) {

	// Extract plain object signature
	var o_keys =Object.keys(object);
		// signature = o_keys.join("+"),
	var sid = encoder.getSignatureID( o_keys );

	// Collect values of all properties
	var values = [];
	for (var i=0, len=o_keys.length; i<len; ++i)
		values.push( object[o_keys[i]] );

	encoder.log(LOG.PLO, "plain["+sid+"], signature="+o_keys.toString()+", sid="+sid);

	// Split entity ID in a 11-bit number
	var sid_hi = (sid & 0x700) >> 8,
		sid_lo =  sid & 0xFF;

	// We have a known entity ID, re-use it
	encoder.stream8.write( pack1b( PRIM_OP.OBJECT | OBJ_OP.PLAIN_LOOKUP | sid_hi ) );
	encoder.stream8.write( pack1b( sid_lo ) );
	encoder.counters.op_prm+=2;

	// Keep iref and encode
	encodeArray( encoder, values );

}
function encodePlainObject ( encoder , object ) { // Extract plain object signature var o_keys = Object . keys ( object ) ; // signature = o_keys.join("+"), var sid = encoder . getSignatureID ( o_keys ) ; // Collect values of all properties var values = [ ] ; for ( var i = 0 , len = o_keys . length ; i < len ; ++ i ) values . push ( object [ o_keys [ i ] ] ) ; encoder . log ( LOG . PLO , "plain[" + sid + "], signature=" + o_keys . toString ( ) + ", sid=" + sid ) ; // Split entity ID in a 11-bit number var sid_hi = ( sid & 0x700 ) >> 8 , sid_lo = sid & 0xFF ; // We have a known entity ID, re-use it encoder . stream8 . write ( pack1b ( PRIM_OP . OBJECT | OBJ_OP . PLAIN_LOOKUP | sid_hi ) ) ; encoder . stream8 . write ( pack1b ( sid_lo ) ) ; encoder . counters . op_prm += 2 ; // Keep iref and encode encodeArray ( encoder , values ) ; }
Encode plain object
Encode plain object