build/components_concat.js
function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {
                    if (obj === null || typeof obj !== 'object') {
                        // Convert enum values to their respective names
                        if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {
                            var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);
                            if (name !== null)
                                return name;
                        }
                        // Pass-through string, number, boolean, null...
                        return obj;
                    }
                    // Convert ByteBuffers to raw buffer or strings
                    if (ByteBuffer.isByteBuffer(obj))
                        return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();
                    // Convert Longs to proper objects or strings
                    if (ProtoBuf.Long.isLong(obj))
                        return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);
                    var clone;
                    // Clone arrays
                    if (Array.isArray(obj)) {
                        clone = [];
                        obj.forEach(function(v, k) {
                            clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);
                        });
                        return clone;
                    }
                    clone = {};
                    // Convert maps to objects
                    if (obj instanceof ProtoBuf.Map) {
                        var it = obj.entries();
                        for (var e = it.next(); !e.done; e = it.next())
                            clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);
                        return clone;
                    }
                    // Everything else is a non-null object
                    var type = obj.$type,
                        field = undefined;
                    for (var i in obj)
                        if (obj.hasOwnProperty(i)) {
                            if (type && (field = type.getChild(i)))
                                clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);
                            else
                                clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);
                        }
                    return clone;
                }
function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {
                    if (obj === null || typeof obj !== 'object') {
                        // Convert enum values to their respective names
                        if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {
                            var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);
                            if (name !== null)
                                return name;
                        }
                        // Pass-through string, number, boolean, null...
                        return obj;
                    }
                    // Convert ByteBuffers to raw buffer or strings
                    if (ByteBuffer.isByteBuffer(obj))
                        return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();
                    // Convert Longs to proper objects or strings
                    if (ProtoBuf.Long.isLong(obj))
                        return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);
                    var clone;
                    // Clone arrays
                    if (Array.isArray(obj)) {
                        clone = [];
                        obj.forEach(function(v, k) {
                            clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);
                        });
                        return clone;
                    }
                    clone = {};
                    // Convert maps to objects
                    if (obj instanceof ProtoBuf.Map) {
                        var it = obj.entries();
                        for (var e = it.next(); !e.done; e = it.next())
                            clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);
                        return clone;
                    }
                    // Everything else is a non-null object
                    var type = obj.$type,
                        field = undefined;
                    for (var i in obj)
                        if (obj.hasOwnProperty(i)) {
                            if (type && (field = type.getChild(i)))
                                clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);
                            else
                                clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);
                        }
                    return clone;
                }
function cloneRaw ( obj , binaryAsBase64 , longsAsStrings , resolvedType ) { if ( obj === null || typeof obj !== 'object' ) { // Convert enum values to their respective names
 if ( resolvedType && resolvedType instanceof ProtoBuf . Reflect . Enum ) { var name = ProtoBuf . Reflect . Enum . getName ( resolvedType . object , obj ) ; if ( name !== null ) return name ; } // Pass-through string, number, boolean, null...
 return obj ; } // Convert ByteBuffers to raw buffer or strings
 if ( ByteBuffer . isByteBuffer ( obj ) ) return binaryAsBase64 ? obj . toBase64 ( ) : obj . toBuffer ( ) ; // Convert Longs to proper objects or strings
 if ( ProtoBuf . Long . isLong ( obj ) ) return longsAsStrings ? obj . toString ( ) : ProtoBuf . Long . fromValue ( obj ) ; var clone ; // Clone arrays
 if ( Array . isArray ( obj ) ) { clone = [ ] ; obj . forEach ( function ( v , k ) { clone [ k ] = cloneRaw ( v , binaryAsBase64 , longsAsStrings , resolvedType ) ; } ) ; return clone ; } clone = { } ; // Convert maps to objects
 if ( obj instanceof ProtoBuf . Map ) { var it = obj . entries ( ) ; for ( var e = it . next ( ) ; ! e . done ; e = it . next ( ) ) clone [ obj . keyElem . valueToString ( e . value [ 0 ] ) ] = cloneRaw ( e . value [ 1 ] , binaryAsBase64 , longsAsStrings , obj . valueElem . resolvedType ) ; return clone ; } // Everything else is a non-null object
 var type = obj . $type , field = undefined ; for ( var i in obj ) if ( obj . hasOwnProperty ( i ) ) { if ( type && ( field = type . getChild ( i ) ) ) clone [ i ] = cloneRaw ( obj [ i ] , binaryAsBase64 , longsAsStrings , field . resolvedType ) ; else clone [ i ] = cloneRaw ( obj [ i ] , binaryAsBase64 , longsAsStrings ) ; } return clone ; }
Clones a message object or field value to a raw object.
@param {*} obj Object to clone
@param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise
@param {boolean} longsAsStrings Whether to encode longs as strings
@param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field
@returns {*} Cloned object
@inner
Clones a message object or field value to a raw object .