serialize.esm.js
function __serializeObject(data, options=DEFAULT_OPTIONS) {
	let dataBuffers = [];
	let allKeys = (options.sort_key === true) ? Object.keys(data).sort() : Object.keys(data);
	// ignore undefined value
	for (let key of allKeys) {
		let subData = data[key];
		if (subData === undefined) continue;

		let subType = __getType(subData, options);
		let subTypeBuffer = __serializeType(subType);
		let keyBuffers = __serializeShortString(key);
		let subDataBuffers = __serializeData(subType, subData, options);
		dataBuffers.push(subTypeBuffer, ...keyBuffers, ...subDataBuffers);
	}
	let length = __getLengthByArrayBuffers(dataBuffers);
	let lengthData = new Uint32Array([length]);
	return [lengthData.buffer, ...dataBuffers];
}
function __serializeObject(data, options=DEFAULT_OPTIONS) {
	let dataBuffers = [];
	let allKeys = (options.sort_key === true) ? Object.keys(data).sort() : Object.keys(data);
	// ignore undefined value
	for (let key of allKeys) {
		let subData = data[key];
		if (subData === undefined) continue;

		let subType = __getType(subData, options);
		let subTypeBuffer = __serializeType(subType);
		let keyBuffers = __serializeShortString(key);
		let subDataBuffers = __serializeData(subType, subData, options);
		dataBuffers.push(subTypeBuffer, ...keyBuffers, ...subDataBuffers);
	}
	let length = __getLengthByArrayBuffers(dataBuffers);
	let lengthData = new Uint32Array([length]);
	return [lengthData.buffer, ...dataBuffers];
}
function __serializeObject ( data , options = DEFAULT_OPTIONS ) { let dataBuffers = [ ] ; let allKeys = ( options . sort_key === true ) ? Object . keys ( data ) . sort ( ) : Object . keys ( data ) ; // ignore undefined value for ( let key of allKeys ) { let subData = data [ key ] ; if ( subData === undefined ) continue ; let subType = __getType ( subData , options ) ; let subTypeBuffer = __serializeType ( subType ) ; let keyBuffers = __serializeShortString ( key ) ; let subDataBuffers = __serializeData ( subType , subData , options ) ; dataBuffers . push ( subTypeBuffer , ... keyBuffers , ... subDataBuffers ) ; } let length = __getLengthByArrayBuffers ( dataBuffers ) ; let lengthData = new Uint32Array ( [ length ] ) ; return [ lengthData . buffer , ... dataBuffers ] ; }
Serialize object data
@param {Object} data
@param {Object} options
@param {boolean} options.sort_key
@param {boolean} options.streaming_array
@param {boolean} options.streaming_object
@returns {ArrayBuffer[]}
@private
Serialize object data