JCloudYu/beson · deserialize.esm.js
javascript logo
function __deserializeContent(buffer, start, options) {
	let type, data;
	({ anchor: start, value: type } = __deserializeType(buffer, start, options));
	({ anchor: start, value: data } = __deserializeData(type, buffer, start, options));
	return { anchor: start, value: data };
}
Similar code snippets
1.
JCloudYu/beson · deserialize.esm.js
Match rating: 77.03% · See similar code snippets
javascript logo
function __deserializeObject(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, subKey, subData;
		({ anchor: start, value: subType } = __deserializeType(buffer, start, options));
		({ anchor: start, value: subKey } = __deserializeShortString(buffer, start, options));
		({ anchor: start, value: subData } = __deserializeData(subType, buffer, start, options));
		data[subKey] = subData;
	}
	return { anchor: end, value: data };
}
2.
JCloudYu/beson · deserialize.esm.js
Match rating: 76.73% · See similar code snippets
javascript logo
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 };
}
3.
JCloudYu/beson · deserialize.esm.js
Match rating: 73.17% · See similar code snippets
javascript logo
function __deserializeObjectStreaming(buffer, start, options) {
	let end = start;
	let dataView = new DataView(buffer);
	let endData = new Uint16Array(TYPE_HEADER.OBJECT_END);
	let data = {};
	while (start < buffer.byteLength) {
		let tmpType = dataView.getUint16(start, true);
		if (tmpType === endData[0]) {
			end += 2;
			break;
		}

		let subType, subKey, subData;
		({ anchor: start, value: subType } = __deserializeType(buffer, start, options));
		({ anchor: start, value: subKey } = __deserializeShortString(buffer, start, options));
		({ anchor: start, value: subData } = __deserializeData(subType, buffer, start, options));
		data[subKey] = subData;
		end = start;
	}
	return { anchor: end, value: data };
}
4.
JCloudYu/beson · deserialize.esm.js
Match rating: 72.34% · See similar code snippets
javascript logo
function __deserializeData(type, buffer, start, options) {
	let result = {anchor:start, value:undefined};
	if (type === DATA_TYPE.NULL) {
		result = __deserializeNull(start, options);
	}
	else if (type === DATA_TYPE.FALSE || type === DATA_TYPE.TRUE) {
		result = __deserializeBoolean(type, start, options);
	}
	else if (type === DATA_TYPE.INT8) {
		result = __deserializeInt8(buffer, start, options);
	}
	else if (type === DATA_TYPE.INT16) {
		result = __deserializeInt16(buffer, start, options);
	}
	else if (type === DATA_TYPE.INT32) {
		result = __deserializeInt32(buffer, start, options);
	}
	else if (type === DATA_TYPE.INT64) {
		result = __deserializeInt64(buffer, start, options);
	}
	else if (type === DATA_TYPE.INT128) {
		result = __deserializeInt128(buffer, start, options);
	}
	else if (type === DATA_TYPE.INT256) {
		result = __deserializeInt256(buffer, start, options);
	}
	else if (type === DATA_TYPE.INT512) {
		result = __deserializeInt512(buffer, start, options);
	}
	else if (type === DATA_TYPE.INTVAR) {
		result = __deserializeIntVar(buffer, start, options);
	}
	else if (type === DATA_TYPE.UINT8) {
		result = __deserializeUInt8(buffer, start, options);
	}
	else if (type === DATA_TYPE.UINT16) {
		result = __deserializeUInt16(buffer, start, options);
	}
	else if (type === DATA_TYPE.UINT32) {
		result = __deserializeUInt32(buffer, start, options);
	}
	else if (type === DATA_TYPE.UINT64) {
		result = __deserializeUInt64(buffer, start, options);
	}
	else if (type === DATA_TYPE.UINT128) {
		result = __deserializeUInt128(buffer, start, options);
	}
	else if (type === DATA_TYPE.UINT256) {
		result = __deserializeUInt256(buffer, start, options);
	}
	else if (type === DATA_TYPE.UINT512) {
		result = __deserializeUInt512(buffer, start, options);
	}
	else if (type === DATA_TYPE.UINTVAR) {
		result = __deserializeUIntVar(buffer, start, options);
	}
	else if (type === DATA_TYPE.FLOAT32) {
		result = __deserializeFloat32(buffer, start, options);
	}
	else if (type === DATA_TYPE.FLOAT64) {
		result = __deserializeFloat64(buffer, start, options);
	}
	else if (type === DATA_TYPE.STRING) {
		result = __deserializeString(buffer, start, options);
	}
	else if (type === DATA_TYPE.ARRAY) {
		result = __deserializeArray(buffer, start, options);
	}
	else if (type === DATA_TYPE.ARRAY_START) {
		result = __deserializeArrayStreaming(buffer, start, options);
	}
	else if (type === DATA_TYPE.OBJECT) {
		result = __deserializeObject(buffer, start, options);
	}
	else if (type === DATA_TYPE.OBJECT_START) {
		result = __deserializeObjectStreaming(buffer, start, options);
	}
	else if (type === DATA_TYPE.DATE) {
		result = __deserializeDate(buffer, start, options);
	}
	else if (type === DATA_TYPE.OBJECTID) {
		result = __deserializeObjectId(buffer, start, options);
	}
	else if (type === DATA_TYPE.BINARY) {
		result = __deserializeArrayBuffer(buffer, start, options);
		result.value = Binary.FromArrayBuffer(result.value);
	}
	else if (type === DATA_TYPE.ARRAY_BUFFER) {
		result = __deserializeArrayBuffer(buffer, start, options);
	}
	else if (type === DATA_TYPE.DATA_VIEW) {
		result = __deserializeArrayBuffer(buffer, start, options);
		result.value = new DataView(result.value);
	}
	else if (type === DATA_TYPE.UINT8_ARRAY) {
		result = __deserializeArrayBuffer(buffer, start, options);
		result.value = new Uint8Array(result.value);
	}
	else if (type === DATA_TYPE.INT8_ARRAY) {
		result = __deserializeArrayBuffer(buffer, start, options);
		result.value = new Int8Array(result.value);
	}
	else if (type === DATA_TYPE.UINT16_ARRAY) {
		result = __deserializeArrayBuffer(buffer, start, options);
		result.value = new Uint16Array(result.value);
	}
	else if (type === DATA_TYPE.INT16_ARRAY) {
		result = __deserializeArrayBuffer(buffer, start, options);
		result.value = new Int16Array(result.value);
	}
	else if (type === DATA_TYPE.UINT32_ARRAY) {
		result = __deserializeArrayBuffer(buffer, start, options);
		result.value = new Uint32Array(result.value);
	}
	else if (type === DATA_TYPE.INT32_ARRAY) {
		result = __deserializeArrayBuffer(buffer, start, options);
		result.value = new Int32Array(result.value);
	}
	else if (type === DATA_TYPE.FLOAT32_ARRAY) {
		result = __deserializeArrayBuffer(buffer, start, options);
		result.value = new Float32Array(result.value);
	}
	else if (type === DATA_TYPE.FLOAT64_ARRAY) {
		result = __deserializeArrayBuffer(buffer, start, options);
		result.value = new Float64Array(result.value);
	}
	else if (type === DATA_TYPE.SPECIAL_BUFFER) {
		result = __deserializeArrayBuffer(buffer, start, options);
		result.value = HAS_NODE_BUFFER ? Buffer.from(result.value) : new Uint8Array(result.value);
	}
	
	return result;
}
5.
lyveminds/scamandrios · row.js
Match rating: 68.06% · See similar code snippets
javascript logo
function(map, member)
    {
        var name = member.name;

        // `SELECT *` queries contain a vestigial `KEY` column.
        if (name == 'KEY')
            return map;

        // Individual columns may specify custom name and value deserializers.
        // `CompositeType` columns make use of the former.
        var deserializeNameType = nameTypes && nameTypes[name],
            deserializeValueType = valueTypes && valueTypes[name];

        var deserializeName = (deserializeNameType ? new Marshal(deserializeNameType) : defaultNameDeserializer).deserialize,
            deserializeValue = (deserializeValueType ? new Marshal(deserializeValueType) : defaultValueDeserializer).deserialize;

        var deserializedName = deserializeName(name),
            value = schema.noDeserialize ? member.value : deserializeValue(member.value),
            column = new Column(deserializedName, value, new Date(member.timestamp / 1000), member.ttl);

        map[deserializedName] = row.push(column) - 1;
        return map;
    }
6.
canjs/dom-diff · deserialize.js
Match rating: 66.09% · See similar code snippets
javascript logo
function deserializeProp(s, prop, value, diffOptions) {
	var deserialized;

	if(isArray(value)) {
		deserialized = value.map(function(p){
			return deserializePatch(p, diffOptions);
		});
	} else {
		deserialized = deserializePatch(value, diffOptions);
	}

	s[prop] = deserialized;
}
7.
mapbox/tilelive · stream-util.js
Match rating: 65.01% · See similar code snippets
javascript logo
function deserialize(data, property) {
    if (property) return getSerializedProperty(data, property);
    if (data.indexOf('{"z":') === 0) return deserializeTile(data);
    if (data.indexOf('{') === 0) return deserializeInfo(data);
    if (data === '') return null;

    throw new DeserializationError('Invalid data');
}
8.
romainhild/node-xmlrpc-socket · client.js
Match rating: 64.48% · See similar code snippets
javascript logo
function() {
	var deserializer = new Deserializer();
	that.stream.push(null);
    	deserializer.deserializeMethodResponse(that.stream, callback);
    }
9.
lyveminds/scamandrios · row.js
Match rating: 63.96% · See similar code snippets
javascript logo
function Row(data, schema)
{
    var row = [];
    row.__proto__ = Row.prototype;

    var defaultNameDeserializer = new Marshal(schema.default_name_type || row.nameType),
        defaultValueDeserializer = new Marshal(schema.default_value_type || row.valueType);

    var nameTypes = schema.name_types,
        valueTypes = schema.value_types;

    // Build a name-to-index lookup map for efficiency.
    var nameToIndex = _.reduce(data.columns, function(map, member)
    {
        var name = member.name;

        // `SELECT *` queries contain a vestigial `KEY` column.
        if (name == 'KEY')
            return map;

        // Individual columns may specify custom name and value deserializers.
        // `CompositeType` columns make use of the former.
        var deserializeNameType = nameTypes && nameTypes[name],
            deserializeValueType = valueTypes && valueTypes[name];

        var deserializeName = (deserializeNameType ? new Marshal(deserializeNameType) : defaultNameDeserializer).deserialize,
            deserializeValue = (deserializeValueType ? new Marshal(deserializeValueType) : defaultValueDeserializer).deserialize;

        var deserializedName = deserializeName(name),
            value = schema.noDeserialize ? member.value : deserializeValue(member.value),
            column = new Column(deserializedName, value, new Date(member.timestamp / 1000), member.ttl);

        map[deserializedName] = row.push(column) - 1;
        return map;
    }, {});

    Object.defineProperties(row,
    {
        'nameToIndex': { 'value': nameToIndex },
        'schema': { 'value': schema },
        'key': { 'value': data.key }
    });

    return row;
}
10.
JCloudYu/beson · deserialize.esm.js
Match rating: 63.59% · See similar code snippets
javascript logo
function __deserializeInt8(buffer, start, options) {
	let end = start + 1;
	let dataView = new DataView(buffer);
	let data = dataView.getInt8(start);
	return { anchor: end, value:options.use_native_types ? data : Int8.from(data) };
}