docs: function encodePrimitive( encoder, data ) {
  
  	// ===============================
  	//  Plain Objects
  	// ===============================
  
  	if (data === false) {
  
  		// Write simple primitive
  		encoder.log(LOG.PRM, "simple[false]");
  		encoder.stream8.write( pack1b( PRIM_OP.SIMPLE | PRIM_SIMPLE.FALSE ) );
  		encoder.counters.op_prm+=1;
  
  	} else if (data === true) {
  
  		// Write simple primitive
  		encoder.log(LOG.PRM, "simple[true]");
  		encoder.stream8.write( pack1b( PRIM_OP.SIMPLE | PRIM_SIMPLE.TRUE ) );
  		encoder.counters.op_prm+=1;
  
  	} else if (data === undefined) {
  
  		// Write simple primitive
  		encoder.log(LOG.PRM, "simple[undefined]");
  		encoder.stream8.write( pack1b( PRIM_OP.SIMPLE | PRIM_SIMPLE.UNDEFINED ) );
  		encoder.counters.op_prm+=1;
  
  	} else if (data === null) {
  
  		// Write simple primitive
  		encoder.log(LOG.PRM, "simple[null]");
  		encoder.stream8.write( pack1b( PRIM_OP.SIMPLE | PRIM_SIMPLE.NULL ) );
  		encoder.counters.op_prm+=1;
  
  	// ===============================
  	//  Number
  	// ===============================
  
  	} else if (typeof data === "number") {
  
  		if (isNaN(data)) {
  
  			// Write extended simple primitive
  			encoder.log(LOG.PRM, "simple[NaN]");
  			encoder.stream8.write( pack1b( PRIM_OP.SIMPLE_EX | PRIM_SIMPLE_EX.NAN ));
  			encoder.counters.op_prm+=1;
  
  		} else {
  
  			// Get type
  			var numType = getNumType( data, data, (data % 1) !== 0 );
  			if (numType > NUMTYPE.FLOAT64) {
  				throw new Errors.AssertError('A primitive was identified as number but getNumType failed!');
  			}
  
  			// Write header
  			encoder.log(LOG.PRM, "number, type="+_NUMTYPE[numType]+", n="+data);
  			encoder.stream8.write( pack1b( PRIM_OP.NUMBER | numType ) );
  			encoder.counters.op_prm+=1;
  
  			// Write data
  			pickStream( encoder, numType )
  				.write( packByNumType[numType]( data ) );
  
  		}
  
  	// ===============================
  	//  Array
  	// ===============================
  
  	} else if  ((data instanceof Uint8Array) || (data instanceof Int8Array) ||
  				(data instanceof Uint16Array) || (data instanceof Int16Array) ||
  				(data instanceof Uint32Array) || (data instanceof Int32Array) ||
  				(data instanceof Float32Array) || (data instanceof Float64Array) ||
  				(data instanceof Array)) {
  
  		// Write array
  		encodeArray( encoder, data );
  
  	// ===============================
  	//  Buffers
  	// ===============================
  
  	} else if (typeof data === "string") {
  
  		// Write a string buffer primitive
  		encoder.log(LOG.PRM, "buffer[string], len="+data.length);
  		encodeStringBuffer( encoder, data );
  
  	} else if (data instanceof FileResource) {
  
  		// Embed file resource
  		encoder.log(LOG.PRM, "buffer[resource], file="+data.src+", mime="+data.mime);
  		encodeEmbeddedFileBuffer( encoder, PRIM_BUFFER_TYPE.RESOURCE, data.src, data.mime );
  
  	} else if (data instanceof BlobResource) {
  
  		// Embed file resource
  		encoder.log(LOG.PRM, "buffer[blob], mime="+data.mime);
  		encodeEmbeddedBlobBuffer( encoder, PRIM_BUFFER_TYPE.RESOURCE, data.buffer, data.mime );
  
  	} else if (data instanceof ImageElement) {
  
  		// Create a buffer from image
  		encoder.log(LOG.PRM, "buffer[image], file="+data.src);
  		encodeEmbeddedFileBuffer( encoder, PRIM_BUFFER_TYPE.BUF_IMAGE, data.src );
  
  	} else if (data instanceof ScriptElement) {
  
  		// Create a buffer from image
  		encoder.log(LOG.PRM, "buffer[script], file="+data.src);
  		encodeEmbeddedFileBuffer( encoder, PRIM_BUFFER_TYPE.BUF_SCRIPT, data.src );
  
  	} else if (data instanceof VideoElement) {
  
  		// Create a buffer from video
  		encoder.log(LOG.PRM, "buffer[video], file="+data.src);
  		encodeEmbeddedFileBuffer( encoder, PRIM_BUFFER_TYPE.BUF_VIDEO, data.src, data.type );
  
  	} else if (data instanceof AudioElement) {
  
  		// Create a buffer from audio
  		encoder.log(LOG.PRM, "buffer[audio], file="+data.src);
  		encodeEmbeddedFileBuffer( encoder, PRIM_BUFFER_TYPE.BUF_AUDIO, data.src, data.type );
  
  	// ===============================
  	//  Objects
  	// ===============================
  
  	} else if (data.constructor === ({}).constructor) {
  
  		// Encode plain object
  		encoder.log(LOG.PRM, "object[plain]");
  		encodePlainObject( encoder, data );
  
  	} else if (data instanceof Date) {
  
  		// Encode plain object
  		encoder.log(LOG.PRM, "object[date]");
  		encodePrimitiveDate( encoder, data );
  
  	} else {
  
  		// Encode object
  		encoder.log(LOG.PRM, "object[entity]");
  		encodeObject( encoder, data );
  
  	}
  
  }