Serialize data
@param {string} type
@param {*} data
@param {BESONSerializerOption} options
@returns {ArrayBuffer[]}
@private
517322
function __serializeData(type, data, options=DEFAULT_OPTIONS) {
	let buffers = [];
	if (type === DATA_TYPE.NULL) {
		buffers = __serializeNull();
	}
	else if (type === DATA_TYPE.FALSE || type === DATA_TYPE.TRUE) {
		buffers = __serializeBoolean();
	}
	else if (type === DATA_TYPE.UINT8) {
		buffers = [data._ab];
	}
	else if (type === DATA_TYPE.UINT16) {
		buffers = [data._ab];
	}
	else if (type === DATA_TYPE.UINT32) {
		buffers = [data._ab];
	}
	else if (type === DATA_TYPE.INT8) {
		buffers = [data._ab];
	}
	else if (type === DATA_TYPE.INT16) {
		buffers = [data._ab];
	}
	else if (type === DATA_TYPE.INT32) {
		buffers = [data._ab];
	}
	else if (type === DATA_TYPE.INT64) {
		buffers = __serializeInt64(data);
	}
	else if (type === DATA_TYPE.INT128) {
		buffers = __serializeInt128(data);
	}
	else if (type === DATA_TYPE.INT256) {
		buffers = __serializeInt256(data);
	}
	else if (type === DATA_TYPE.INT512) {
		buffers = __serializeInt512(data);
	}
	else if (type === DATA_TYPE.INTVAR) {
		buffers = __serializeIntVar(data);
	}
	else if (type === DATA_TYPE.UINT64) {
		buffers = __serializeUInt64(data);
	}
	else if (type === DATA_TYPE.UINT128) {
		buffers = __serializeUInt128(data);
	}
	else if (type === DATA_TYPE.UINT256) {
		buffers = __serializeUInt256(data);
	}
	else if (type === DATA_TYPE.UINT512) {
		buffers = __serializeUInt512(data);
	}
	else if (type === DATA_TYPE.UINTVAR) {
		buffers = __serializeUIntVar(data);
	}
	else if (type === DATA_TYPE.FLOAT64) {
		buffers = __serializeDouble(data);
	}
	else if (type === DATA_TYPE.STRING) {
		buffers = __serializeString(data);
	}
	else if (type === DATA_TYPE.ARRAY) {
		buffers = __serializeArray(data, options);
	}
	else if (type === DATA_TYPE.ARRAY_START) {
		buffers = __serializeArrayStreaming(data, options);
	}
	else if (type === DATA_TYPE.OBJECT) {
		buffers = __serializeObject(data, options);
	}
	else if (type === DATA_TYPE.OBJECT_START) {
		buffers = __serializeObjectStreaming(data, options);
	}
	else if (type === DATA_TYPE.DATE) {
		buffers = __serializeDate(data);
	}
	else if (type === DATA_TYPE.OBJECTID) {
		buffers = __serializeObjectId(data);
	}
	else if (type === DATA_TYPE.BINARY) {
		buffers = __serializeArrayBuffer(data.toBytes());
	}
	else if (type === DATA_TYPE.ARRAY_BUFFER) {
		buffers = __serializeArrayBuffer(data);
	}
	else if (type === DATA_TYPE.DATA_VIEW) {
		buffers = __serializeArrayBuffer(data.buffer);
	}
	else if (type === DATA_TYPE.UINT8_ARRAY) {
		buffers = __serializeArrayBuffer(data.buffer);
	}
	else if (type === DATA_TYPE.INT8_ARRAY) {
		buffers = __serializeArrayBuffer(data.buffer);
	}
	else if (type === DATA_TYPE.UINT16_ARRAY) {
		buffers = __serializeArrayBuffer(data.buffer);
	}
	else if (type === DATA_TYPE.INT16_ARRAY) {
		buffers = __serializeArrayBuffer(data.buffer);
	}
	else if (type === DATA_TYPE.UINT32_ARRAY) {
		buffers = __serializeArrayBuffer(data.buffer);
	}
	else if (type === DATA_TYPE.INT32_ARRAY) {
		buffers = __serializeArrayBuffer(data.buffer);
	}
	else if (type === DATA_TYPE.FLOAT32_ARRAY) {
		buffers = __serializeArrayBuffer(data.buffer);
	}
	else if (type === DATA_TYPE.FLOAT64_ARRAY) {
		buffers = __serializeArrayBuffer(data.buffer);
	}
	else if (HAS_NODE_BUFFER && type === DATA_TYPE.SPECIAL_BUFFER) {
		let buff = Buffer.alloc(data.length);
		data.copy(buff, 0);
		buffers = __serializeArrayBuffer(buff.buffer);
	}
	
	return buffers;
}
1153203
public function deserialize(array $data, Item $item = null, array $options = [])
    {
        return $this->serializer->deserialize($data, $item, $options);
    }
352918
def serialize(self, data):
        

        super(Serializer, self).serialize(data)

        self.resp.content_type += '; header=present'
        import pprint
        pprint.PrettyPrinter().pprint(data)
285058
function serialize(model) {
    var data = model.toJSON();
    Object.keys(data).forEach(function serializeRecur(key) {
        var value = data[key];
        // if any value can be serialized toJSON() then do it
        if (value && value.toJSON) {
            data[key] = data[key].toJSON();
        }
    });
    return data;
}
968039
function createChunk(type, data) {
	const length = typeof data != 'undefined' ? data.length : 0;
	const chunk = Buffer.alloc(4 + 4 + length + 4);

	chunk.writeUInt32BE(length, 0);
	chunk.fill(type, 4, 8, 'utf8');
	if (typeof data != 'undefined') {
		chunk.fill(data, 8, chunk.length - 4);
	}
	chunk.writeUInt32BE(crc32(chunk.slice(4, -4)), chunk.length - 4);

	return chunk;
}
820146
function (data) {
            const _mode = QRMode.MODE_8BIT_BYTE;
            const _bytes = qrcode.stringToBytes(data);
            const _this = {};

            _this.getMode = function () {
                return _mode;
            };

            _this.getLength = function () {
                return _bytes.length;
            };

            /**
             * @param {QrBitBuffer} buffer
             */
            _this.write = function (buffer) {
                for (let i = 0; i < _bytes.length; i += 1) {
                    buffer.put(_bytes[i], 8);
                }
            };

            return _this;
        }
234758
public function deserialize($data, $content = null, array $options = [])
    {
        if ('text/html' === $data['type'] || 'text/plain' === $data['type']) {
            // HTML is directly stored in the choice entity
            $content->setData($data['data']);
            $content->setResourceNode(null);
        } else {
            // Other types require a ResourceNode
            $node = $this->resourceContentSerializer->deserialize($content);

            $content->setData('');
            $content->setResourceNode($node);
        }

        return $content;
    }
874253
function __serializeString(data) {
	let dataBuffer = UTF8Encode(data);
	let length = dataBuffer.byteLength;
	let lengthData = new Uint32Array([length]);
	return [lengthData.buffer, dataBuffer];
}
530117
function encode (data, buffer, offset) {
  var buffers = []
  var result = null

  encode._encode(buffers, data)
  result = Buffer.concat(buffers)
  encode.bytes = result.length

  if (Buffer.isBuffer(buffer)) {
    result.copy(buffer, offset)
    return buffer
  }

  return result
}
802375
public static function data( $data, $name = null, $type = null, $options = null ) {

		$data = (array) apply_filters( "pods_form_ui_field_{$type}_data", $data, $name, $options );

		foreach ( $data as $key => $value ) {
			if ( null === $value ) {
				continue;
			}

			$key = sanitize_title( $key );

			if ( is_array( $value ) ) {
				$value = implode( ',', $value );
			}

			echo ' data-' . esc_attr( (string) $key ) . '="' . esc_attr( (string) $value ) . '"';
		}
	}
739411
function __deserializeArray(buffer, start, options) {
	let dataView = new DataView(buffer);
	let length = dataView.getUint32(start, true);
	start += 4;
	let end = start + length;
	let data = [];
	while (start < end) {
		let subType, subData;
		({ anchor: start, value: subType } = __deserializeType(buffer, start, options));
		({ anchor: start, value: subData } = __deserializeData(subType, buffer, start, options));
		data.push(subData);
	}
	return { anchor: end, value: data };
}
1055656
function (data) {
    var str = '', start = true;
    var jsondata = '';
    for (var key in data) {
      if (typeof (jsondata = JSON.stringify(data[key])) === 'string') {
        str += (start? '': '&');
        str += encodeURIComponent(key) + '=' + encodeURIComponent(jsondata);
        if (start) { start = false; }
      }
    }
    return str;
  }
1360843
function __deserializeString(buffer, start, options) {
	let step = 1;
	let dataView = new DataView(buffer);
	let length = dataView.getUint32(start, true);
	start += 4;
	let end = start + length;
	let dataArray = [];
	for (let i = start; i < end; i += step) {
		dataArray.push(dataView.getUint8(i));
	}
	let data = UTF8Decode(Uint8Array.from(dataArray).buffer);
	return { anchor: end, value: data };
}
188470
function Serialize (elem) {
  if (!(this instanceof Serialize))
    return new Serialize(elem)

  if (!elem || elem.nodeType !== Node.ELEMENT_NODE)
    throw TypeError('Serialize can only serialize element nodes.')

  var text = ''

  this.length = 0
  this.markups = []
  this.type = elem.nodeName.toLowerCase()

  // Automatically update the length when setting the text.
  Object.defineProperty(this, 'text', {
    configurable: true,
    enumerable: true,
    get: function () {
      return text
    },
    set: function (newText) {
      this.length = newText.length
      text = newText
    }
  })

  convert(elem, this)
}
39143
function encodeBuffer(packet, supportsBinary, callback) {
  if (!supportsBinary) {
    return exports.encodeBase64Packet(packet, callback);
  }

  var data = packet.data;
  var typeBuffer = new Buffer(1);
  typeBuffer[0] = packets[packet.type];
  return callback(Buffer.concat([typeBuffer, data]));
}
1365088
function(data, options) {
        if(typeof data == "string") {
            data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
        }

        // Loop throught the following node types in this order and
        // process the nodes found 
        var types = ["Link", "NetworkLink", "Style", "StyleMap", "Placemark"];
        for(var i=0, len=types.length; i<len; ++i) {
            var type = types[i];

            var nodes = this.getElementsByTagNameNS(data, "*", type);

            // skip to next type if no nodes are found
            if(nodes.length == 0) { 
                continue;
            }

            switch (type.toLowerCase()) {

                // Fetch external links 
                case "link":
                case "networklink":
                    this.parseLinks(nodes, options);
                    break;

                // parse style information
                case "style":
                    if (this.extractStyles) {
                        this.parseStyles(nodes, options);
                    }
                    break;
                case "stylemap":
                    if (this.extractStyles) {
                        this.parseStyleMaps(nodes, options);
                    }
                    break;

                // parse features
                case "placemark":
                    this.parseFeatures(nodes, options);
                    break;
            }
        }
        
        return this.features;
    }
1275242
public function encode($data, $options = 0) {
        $json = null;

        if ($data instanceof IArrayable) {
            $json = @json_encode($data->toArray(), $options);
        } else if ($data instanceof IJsonable) {
            $json = $data->toJson($options);
        } else if (is_array($data) || is_object($data)) {
            $json =  @json_encode($data, $options);
        } else {
            throw new InvalidDataTypeException(
                s('Can not convert data of type "%s" to json.', get_type($data))
            );
        }

        if ($json === false) {
            throw new JsonEncodeException(json_last_error_msg(), $data);
        }

        return $json;
    }