node_modules/localforage/test copy/localforage.component.js
// some kind of arraybuffer/binary data/typed array out of the string.
some kind of arraybuffer/binary data/typed array out of the string.
some kind of arraybuffer / binary data / typed array out of the string .
function _deserialize(value) {
        if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {
            return JSON.parse(value);
        }
        var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);
        var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);
        var buffer = new ArrayBuffer(serializedString.length * 2); 
        var bufferView = new Uint16Array(buffer);
        for (var i = serializedString.length - 1; i >= 0; i--) {
            bufferView[i] = serializedString.charCodeAt(i);
        }
        switch (type) {
            case TYPE_ARRAYBUFFER:
                return buffer;
            case TYPE_BLOB:
                return new Blob([buffer]);
            case TYPE_INT8ARRAY:
                return new Int8Array(buffer);
            case TYPE_UINT8ARRAY:
                return new Uint8Array(buffer);
            case TYPE_UINT8CLAMPEDARRAY:
                return new Uint8ClampedArray(buffer);
            case TYPE_INT16ARRAY:
                return new Int16Array(buffer);
            case TYPE_UINT16ARRAY:
                return new Uint16Array(buffer);
            case TYPE_INT32ARRAY:
                return new Int32Array(buffer);
            case TYPE_UINT32ARRAY:
                return new Uint32Array(buffer);
            case TYPE_FLOAT32ARRAY:
                return new Float32Array(buffer);
            case TYPE_FLOAT64ARRAY:
                return new Float64Array(buffer);
            default:
                throw new Error('Unkown type: ' + type);
        }
    }
function _deserialize ( value ) { if ( value . substring ( 0 , SERIALIZED_MARKER_LENGTH ) !== SERIALIZED_MARKER ) { return JSON . parse ( value ) ; } var serializedString = value . substring ( TYPE_SERIALIZED_MARKER_LENGTH ) ; var type = value . substring ( SERIALIZED_MARKER_LENGTH , TYPE_SERIALIZED_MARKER_LENGTH ) ; var buffer = new ArrayBuffer ( serializedString . length * 2 ) ; var bufferView = new Uint16Array ( buffer ) ; for ( var i = serializedString . length - 1 ; i >= 0 ; i -- ) { bufferView [ i ] = serializedString . charCodeAt ( i ) ; } switch ( type ) { case TYPE_ARRAYBUFFER : return buffer ; case TYPE_BLOB : return new Blob ( [ buffer ] ) ; case TYPE_INT8ARRAY : return new Int8Array ( buffer ) ; case TYPE_UINT8ARRAY : return new Uint8Array ( buffer ) ; case TYPE_UINT8CLAMPEDARRAY : return new Uint8ClampedArray ( buffer ) ; case TYPE_INT16ARRAY : return new Int16Array ( buffer ) ; case TYPE_UINT16ARRAY : return new Uint16Array ( buffer ) ; case TYPE_INT32ARRAY : return new Int32Array ( buffer ) ; case TYPE_UINT32ARRAY : return new Uint32Array ( buffer ) ; case TYPE_FLOAT32ARRAY : return new Float32Array ( buffer ) ; case TYPE_FLOAT64ARRAY : return new Float64Array ( buffer ) ; default : throw new Error ( 'Unkown type: ' + type ) ; } }
some kind of arraybuffer/binary data/typed array out of the string.
some kind of arraybuffer / binary data / typed array out of the string .
// If we haven't marked this string as being specially serialized (i.e. // something other than serialized JSON), we can just return it and be // done with it. // The following code deals with deserializing some kind of Blob or // TypedArray. First we separate out the type of data we're dealing // with from the data itself. // Fill the string into a ArrayBuffer. // 2 bytes for each char // Return the right type based on the code/type set during // serialization.