Prevent circular stringify and convert arguments to real array
8769
function safeToArray(args) {
		const seen = [];
		const argsArray = [];

		let res;

		// Massage some arguments with special treatment
		if (args.length) {
			for (let i = 0; i < args.length; i++) {

				// Any argument of type 'undefined' needs to be specially treated because
				// JSON.stringify will simply ignore those. We replace them with the string
				// 'undefined' which is not 100% right, but good enough to be logged to console
				if (typeof args[i] === 'undefined') {
					args[i] = 'undefined';
				}

				// Any argument that is an Error will be changed to be just the error stack/message
				// itself because currently cannot serialize the error over entirely.
				else if (args[i] instanceof Error) {
					const errorObj = args[i];
					if (errorObj.stack) {
						args[i] = errorObj.stack;
					} else {
						args[i] = errorObj.toString();
					}
				}

				argsArray.push(args[i]);
			}
		}

		// Add the stack trace as payload if we are told so. We remove the message and the 2 top frames
		// to start the stacktrace where the console message was being written
		if (process.env.VSCODE_LOG_STACK === 'true') {
			const stack = new Error().stack;
			argsArray.push({ __$stack: stack.split('\n').slice(3).join('\n') });
		}

		try {
			res = JSON.stringify(argsArray, function (key, value) {

				// Objects get special treatment to prevent circles
				if (isObject(value) || Array.isArray(value)) {
					if (seen.indexOf(value) !== -1) {
						return '[Circular]';
					}

					seen.push(value);
				}

				return value;
			});
		} catch (error) {
			return 'Output omitted for an object that cannot be inspected (' + error.toString() + ')';
		}

		if (res && res.length > MAX_LENGTH) {
			return 'Output omitted for a large object that exceeds the limits';
		}

		return res;
	}
1041770
def stringify(*args):
    
    if (len(args) == 1) and callable(args[0]):
        func = args[0]

        @wraps(func)
        def _inner(*args, **kwargs):
            return "".join([str(i) for i in func(*args, **kwargs)])
        return _inner
    else:
        return "".join([str(i) for i in args])
909104
function flatten(iterable) {
    if (! iterable) return [];

    var array = [];
    for (var i = 0; i < iterable.length; i ++) {
      var current = iterable[i];
      if (Array.isArray(current)) {
        array = array.concat(flatten(current));
      } else if ((typeof(current) === 'object')
              && (typeof(current.length) === 'number')) {
        // JavaScripts' "arguments" is an object, not an array, and on top of
        // that PhantomJS' own implementation is not iterable... Workaround!
        array = array.concat(flatten(current));
      } else {
        array.push(current);
      }
    }
    return array;
  }
1373842
def stringify(x):
    
    result = []

    def go(key, val, format, meta):
        if key in ['Str', 'MetaString']:
            result.append(val)
        elif key == 'Code':
            result.append(val[1])
        elif key == 'Math':
            result.append(val[1])
        elif key == 'LineBreak':
            result.append(" ")
        elif key == 'SoftBreak':
            result.append(" ")
        elif key == 'Space':
            result.append(" ")

    walk(x, go, "", {})
    return ''.join(result)
310070
def stringify(data):
    '''
    
    '''
    ret = []
    for item in data:
        if six.PY2 and isinstance(item, str):
            item = salt.utils.stringutils.to_unicode(item)
        elif not isinstance(item, six.string_types):
            item = six.text_type(item)
        ret.append(item)
    return ret
1147725
function _gpfArrayFromString(array, string) {
        var length = string.length, index = 0;
        for (; index < length; ++index) {
            array.push(string.charAt(index));
        }
    }
172268
function stringify(array) {
    var str = array.toString().split(',').map(function(item) {
      return "'" + item + "'";
    }).toString();
    return str;
  }
34819
function splitArgs(str) {
  const out = [];

  let inString = false;
  let currentArg = '';

  for (let index = 0; index < str.length; index += 1) {
    const c = str[index];
    if (c === ',' && !inString) {
      out.push(currentArg.trim());
      currentArg = '';
    } else if (currentArg.length === 0 && c === '"' && !inString) {
      currentArg += c;
      inString = true;
    } else if (inString && c === '"' && str[index - 1] !== '\\') {
      currentArg += c;
      inString = false;
    } else if (!(c === ' ' && currentArg.length === 0)) {
      currentArg += c;
    }
  }
  out.push(currentArg.trim());

  return out;
}
286882
function(args){
        if(this.isObject(args)){
          return [this.keys(args),this.values(args)];
        }
        if(this.isArgument(args)){
         return [].splice.call(args,0);
        }
        if(!this.isArray(args) && !this.isObject(args)){
          return [args];
        }
    }
140674
function convertToObject(args) {
	let result = {};

	args.forEach((arg, i) => {
		if (Array.isArray(arg)) {
			result[arg[0]] = arg[1];
		} else {
			if (i % 2 === 0) {
				result[arg] = undefined;
			} else {
				result[args[i - 1]] = arg;
			}
		}
	});

	return result;
}
1147297
function stringify(name, attrs) {
    var str = [];
    str.push('<' + name);
    each(function(val, key) {
      str.push(' ' + key + '="' + val + '"');
    }, attrs);
    str.push('>');
    // block
    if (name !== 'img') {
      str.push('</' + name + '>');
    }
    return str.join('');
  }
767011
function stringify(obj) {
            try {
                return JSON.stringify(obj);
            } catch (e) {
                var cache = [];
                return JSON.stringify(obj, function (key, value) {
                    if (angular.isObject(value) && value !== null) {
                        if (cache.indexOf(value) !== -1) {
                            // Circular reference found, discard key
                            return;
                        }
                        // Store value in our collection
                        cache.push(value);
                    }
                    return value;
                });
            }
        }
245822
function tryCatchStringify(obj) {
  try {
    return JSON.stringify(obj);
  } catch (err) {
    /* eslint-disable no-console */
    if (process.env.NODE_ENV !== 'production')
      console.log('Failed to stringify', err);
     no-console */
    return jsan.stringify(obj, null, null, { circular: '[CIRCULAR]' });
  }
}
1191956
function stringify(data, options = {}) {
  const _options$strict = options.strict,
        strict = _options$strict === void 0 ? false : _options$strict;
  return baseFormat(data, strict);
}
552955
function parseCircular(object) {
  // if circular references are disabled, just return the refs object
  if (!config().circularRefs) {
    return object;
  }

  let pointerPath = parsePointer(object.$ref);

  // validate whether the path corresponds with current stack
  for (let i = 0; i < pointerPath.length; i++) {
    if (pointerPath[i] !== path[i]) {
      throw new Error('Invalid circular reference "' +  object.$ref + '"');
    }
  }

  return stack[pointerPath.length];
}
742772
def _void_array_to_nested_list(res, _func, _args):
    
    try:
        shape = res.coords.len, 2
        ptr = cast(res.coords.data, POINTER(c_double))
        array = np.ctypeslib.as_array(ptr, shape)
        return array.tolist()
    finally:
        drop_array(res.coords)
138753
function(input, shallow, strict, startIndex) {
                var output = [], idx = 0;
                for (var i = startIndex || 0, length = getLength(input); i < length; i++) {
                  var value = input[i];
                  if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) {
                    //flatten current level of array or arguments object
                    if (!shallow) value = flatten(value, shallow, strict);
                    var j = 0, len = value.length;
                    output.length += len;
                    while (j < len) {
                      output[idx++] = value[j++];
                    }
                  } else if (!strict) {
                    output[idx++] = value;
                  }
                }
                return output;
              }