/*
Append serialized form of an object/array onto the supplied string.
Returns the passed string.
359529
function writeObject(rh, obj, to, identify) {
            if (typeof to === "undefined") { to = ''; }
            if (typeof identify === "undefined") { identify = false; }
            shared.utils.dassert(shared.utils.isObjectOrArray(rh));
            shared.utils.dassert(shared.utils.isObjectOrArray(obj));
            if(obj instanceof Array) {
                to += '[';
            } else {
                to += '{';
            }
            if(identify) {
                to += rh.valueId(obj) + ' ';
                to += rh.valueRev(obj) + ' ';
            }
            var k = Object.keys(obj);
            for(var i = 0; i < k.length; i++) {
                to = writeValue(rh, k[i], to);
                to += ":";
                to = writeValue(rh, obj[k[i]], to);
                if(i < k.length - 1) {
                    to += ',';
                }
            }
            if(obj instanceof Array) {
                to += ']';
            } else {
                to += '}';
            }
            return to;
        }
355916
function stringify (obj) {
  var s = [];
  Object.keys(obj).forEach(function (key) {
    s.push(key);
    s.push('=\'');
    s.push(obj[key]);
    s.push('\';');
  });
  return s.join('');
}
607927
function stringifyArray(arr, prefix) {
  var ret = [];
  if (!prefix) throw new TypeError('stringify expects an object');
  for (var i = 0; i < arr.length; i++) {
    ret.push(stringify(arr[i], prefix + '[]'));
  }
  return ret.join('&');
}
763629
private String _serializeArray(Array array, Map<Object, String> done, String id) throws ConverterException {
	return _serializeList(array.toList(), done, id);
    }
677645
public ByteBuffer append(String str) {
        if (str != null)
            return append(DocWriter.getISOBytes(str));
        return this;
    }
1073961
@GwtIncompatible("incompatible method")
    public StrBuilder appendln(final String format, final Object... objs) {
        return append(format, objs).appendNewLine();
    }
492824
function stringifyObject(obj, prefix) {
  var ret = []
    , keys = objectKeys(obj)
    , key;
  for (var i = 0, len = keys.length; i < len; ++i) {
    key = keys[i];
    ret.push(stringify(obj[key], prefix
      ? prefix + '[' + encodeURIComponent(key) + ']'
      : encodeURIComponent(key)));
  }
  return ret.join('&');
}
525946
private String serializeArrayList(ArrayList<String> strings) {
        String retString = "";
        for (String value : strings) {
            retString = retString + value + ",";
        }
        retString = retString.substring(0, retString.length() - 1);
        return retString;
    }
177499
function stringToArrayBuffer(string) {
            var
                buffer = new ArrayBuffer(string.length),
                int8Array = new Uint8Array(buffer);
            
            for (var i = 0; i < string.length; i++) {
                int8Array[i] = string.charCodeAt(i);
            }
            
            return buffer;
        }
610389
public static String serialize(Object[] objs)
    {
        StringBuffer buff = new StringBuffer();
        for(int i = 0; i < objs.length; i++)
        {
            if(objs[i] != null)
            {
                buff.append(objs[i].toString());
                if(i != objs.length-1)
                    buff.append(",");
            }
        }
        return buff.toString();
    }
82278
private String _serializeArray(Array array, Set<Object> done) throws ConverterException {
	return _serializeList(array.toList(), done);
    }
865025
function serializeObject(value: mixed): mixed {
  if (typeof value === 'object' && value !== null) {
    if (typeof value.valueOf === 'function') {
      const valueOfResult = value.valueOf();
      if (typeof valueOfResult !== 'object') {
        return valueOfResult;
      }
    }
    if (typeof value.toJSON === 'function') {
      // $FlowFixMe(>=0.90.0)
      return value.toJSON();
    }
  }
  return value;
}
462896
public void append(String str) {
	if (str == null) return;
	int restLength = buffer.length - pos;
	if (str.length() < restLength) {
	    str.getChars(0, str.length(), buffer, pos);
	    pos += str.length();
	}
	else {
	    str.getChars(0, restLength, buffer, pos);
	    curr.next = new Entity(buffer);
	    curr = curr.next;
	    length += buffer.length;
	    buffer = new char[(buffer.length > str.length() - restLength) ? buffer.length : str.length() - restLength];

	    str.getChars(restLength, str.length(), buffer, 0);
	    pos = str.length() - restLength;

	}
    }
890804
function append(arrlike /* , items... */) {
    return Array.prototype.slice.call(arrlike, 0).concat(Array.prototype.slice.call(arguments, 1));
}
480715
public static void append(Appendable out, Object object) throws IOException {
        if (object instanceof String) {
            out.append((String) object);
        } else if (object instanceof Object[]) {
            out.append(toArrayString((Object[]) object));
        } else if (object instanceof Map) {
            out.append(toMapString((Map) object));
        } else if (object instanceof Collection) {
            out.append(toListString((Collection) object));
        } else if (object instanceof Writable) {
            Writable writable = (Writable) object;
            Writer stringWriter = new StringBuilderWriter();
            writable.writeTo(stringWriter);
            out.append(stringWriter.toString());
        } else if (object instanceof InputStream || object instanceof Reader) {
            // Copy stream to stream
            Reader reader;
            if (object instanceof InputStream) {
                reader = new InputStreamReader((InputStream) object);
            } else {
                reader = (Reader) object;
            }
            char[] chars = new char[8192];
            int i;
            while ((i = reader.read(chars)) != -1) {
                for (int j = 0; j < i; j++) {
                    out.append(chars[j]);
                }
            }
            reader.close();
        } else {
            out.append(toString(object));
        }
    }
903387
public static String jsonJoin(String[] array) {
        int arraySize = array.length;
        int bufSize = arraySize * (array[0].length() + 3);
        StringBuilder buf = new StringBuilder(bufSize);
        for (int i = 0; i < arraySize; i++) {
            if (i > 0) {
                buf.append(',');
            }

            buf.append('"');
            buf.append(array[i]);
            buf.append('"');
        }
        return buf.toString();
    }
804847
private String _serializeMap(String name, Map map, StringBuilder sb, Set<Object> done) throws ConverterException {

	if (useShortcuts) sb.append("{}");
	else sb.append("new Object();");
	Iterator it = map.keySet().iterator();
	while (it.hasNext()) {
	    Object key = it.next();
	    String skey = StringUtil.toLowerCase(StringUtil.escapeJS(key.toString(), '"'));
	    sb.append(name + "[" + skey + "]=");
	    _serialize(name + "[" + skey + "]", map.get(key), sb, done);
	    // sb.append(";");
	}
	return sb.toString();
    }