Parse string data into swagger 2.0 object (https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swagger-object)

@param {string} rawData

@returns {Object|null} Swagger 2.0 object
500711
async function parseDocument(rawData) {
  try {
    return utils.unthrowableParseJson(rawData) || SwaggerParser.YAML.parse(rawData);
  } catch (err) {
    return null;
  }
}
1271533
private function getHeaders($rawData)
    {
        if (is_string($rawData)) {
            $rawData = explode("\n", $rawData);
        }

        $key = null;
        $headers = array();
        foreach ($rawData as $line) {
            $line = trim($line);
            if (preg_match("/^([a-zA-Z0-9-]+):/i", $line, $matches)) {
                $key = strtolower($matches[1]);
                if (isset($headers[$key])) {
                    if (!is_array($headers[$key])) {
                        $headers[$key] = array($headers[$key]);
                    }

                    $headers[$key][] = trim(str_replace($matches[0], '', $line));
                    continue;
                }

                $headers[$key] = trim(str_replace($matches[0], '', $line));
                continue;
            }

            if (!is_null($key) && isset($headers[$key])) {
                if (is_array($headers[$key])) {
                    $headers[$key][count($headers[$key])-1] .= ' '.$line;
                    continue;
                }

                $headers[$key] .= ' '.$line;
            }
        }

        return $headers;
    }
832240
function parseURL2ChartData(url, callback) {
  const success = code => {
    const chartData = parseDSV2ChartData(code);

    callback(chartData);
  };
  const fail = () => callback(null);

  $.get(url).done(success).fail(fail);
}
1086805
function (requestV1) {
        var modes = {
                urlencoded: 'urlencoded',
                params: 'formdata',
                raw: 'raw',
                binary: 'file'
            },
            data = {},
            rawModeData,
            dataMode = modes[requestV1.dataMode],
            retainEmpty = this.options.retainEmptyValues;

        // set null body if neither data|rawModeData nor dataMode is set, or if the dataMode is explicitly set to null
        // The explicit null check is added to ensure that body is not set in case the dataMode was set to null by the
        // app, but `data` or `rawModeData` was not empty
        if ((!dataMode && _.isEmpty(requestV1.data) && _.isEmpty(requestV1.rawModeData)) ||
            requestV1.dataMode === null) {
            return retainEmpty ? null : undefined;
        }

        // set `rawModeData` if its a string
        if (_.isString(requestV1.rawModeData)) {
            rawModeData = requestV1.rawModeData;
        }
        // check if `rawModeData` is an array like: ['rawModeData']
        else if (Array.isArray(requestV1.rawModeData) &&
            requestV1.rawModeData.length === 1 &&
            _.isString(requestV1.rawModeData[0])) {
            rawModeData = requestV1.rawModeData[0];
        }

        // set data.mode.
        // if dataMode is not set, infer from data or rawModeData
        // at this point either data or rawModeData is set
        if (dataMode) {
            data.mode = dataMode;
        }
        // set `formdata` if rawModeData is not set and data is an array
        // `data` takes higher precedence over `rawModeData`.
        else if (!rawModeData && Array.isArray(requestV1.data || requestV1.rawModeData)) {
            data.mode = 'formdata';
        }
        // set `raw` mode as default
        else {
            data.mode = 'raw';
        }

        if (data.mode === 'raw') {
            if (rawModeData) {
                data[data.mode] = rawModeData;
            }
            else if (_.isString(requestV1.data)) {
                data[data.mode] = requestV1.data;
            }
            else {
                data[data.mode] = ''; // empty string instead of retainEmpty check to have parity with other modes.
            }
        }
        else if (data.mode === 'file') {
            data[data.mode] = { src: rawModeData }; // rawModeData can be string or undefined.
        }
        else {
            // parse data for formdata or urlencoded data modes.
            // `rawModeData` is checked in case its of type `data`.
            data[data.mode] = parseFormData(requestV1.data || requestV1.rawModeData, retainEmpty);
        }

        if (requestV1.dataDisabled) { data.disabled = true; }
        else if (retainEmpty) { data.disabled = false; }

        return data;
    }
956968
public org.w3c.dom.Node getMessageBody(Object rawData, boolean bReturnCopy)
    {
        if (this.getRawData() instanceof String)
        {   // Always
            String strXML = this.getXML();
            return Utility.convertXMLToDOM(strXML);
        }
        return super.getMessageBody(rawData, bReturnCopy);
    }
57640
function swaggerMetadata (req, res, next) {
  /**
   * The Swagger Metadata that is added to each HTTP request.
   * This object is exposed as `req.swagger`.
   *
   * @name Request#swagger
   */
  req.swagger = {
    /**
     * The complete Swagger API object.
     * (see https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#swagger-object)
     * @type {SwaggerObject|null}
     */
    api: null,

    /**
     * The Swagger path name, as it appears in the Swagger API.
     * (e.g. "/users/{username}/orders/{orderId}")
     * @type {string}
     */
    pathName: "",

    /**
     * The Path object from the Swagger API.
     * (see https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#pathItemObject)
     * @type {object|null}
     */
    path: null,

    /**
     * The Operation object from the Swagger API.
     * (see https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#operationObject)
     * @type {object|null}
     */
    operation: null,

    /**
     * The Parameter objects that apply to this request.
     * (see https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#parameter-object-)
     * @type {object[]}
     */
    params: [],

    /**
     * The Security Requirement objects that apply to this request.
     * (see https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#securityRequirementObject)
     * @type {object[]}
     */
    security: []
  };

  next();
}
451882
function parse(raw) {
    var output = '';
    var ast = esprima.parse(raw, {
        range: true,
        raw: true
    });

    var defines = ast.body.filter(isDefine);

    if (defines.length > 1) {
        throw new Error('Each file can have only a single define call. Found "' + defines.length + '"');
    }
    else if (!defines.length) {
        return raw;
    }

    var def = defines[0];
    var args = def.expression['arguments'];
    var factory = getFactory(args);
    var useStrict = getUseStrict(factory);

    // do replacements in-place to avoid modifying the code more than needed
    if (useStrict) {
        output += useStrict.expression.raw + ';\n';
    }
    output += raw.substring(0, def.range[0]); // anything before define
    output += getRequires(args, factory); // add requires
    output += getBody(raw, factory.body, useStrict); // module body

    output += raw.substring(def.range[1], raw.length); // anything after define

    return output;
}
972695
public Object convert(String rawString, Type type) {
        Object value = convert(rawString, type, null);
        return value;
    }
874253
function __serializeString(data) {
	let dataBuffer = UTF8Encode(data);
	let length = dataBuffer.byteLength;
	let lengthData = new Uint32Array([length]);
	return [lengthData.buffer, dataBuffer];
}
1116091
function parse_ImData(blob, length, opts) {
	var tgt = blob.l + length;
	var cf = blob.read_shift(2);
	var env = blob.read_shift(2);
	var lcb = blob.read_shift(4);
	var o = {fmt:cf, env:env, len:lcb, data:blob.slice(blob.l,blob.l+lcb)};
	blob.l += lcb;
	return o;
}
550486
function camelCaseData(data) {
  const result = {};
  const keys = Object.keys(data);
  keys.forEach((k) => {
    const key = camelCase(k);
    const value = data[k];
    if (isObject(value)) {
      result[key] = camelCaseData(value);
    } else {
      result[key] = value;
    }
  });
  return result;
}
638203
def _parse(cls, data, key=None):
        
        parse = cls.parse if cls.parse is not None else cls.get_endpoint()

        if callable(parse):
            data = parse(data)
        elif isinstance(parse, str):
            data = data[key]
        else:
            raise Exception('"parse" should be a callable or string got, {0}'
                            .format(parse))
        return data
1032345
public function toUrl($rawData): string
    {
        $data = $this->processRawData($rawData);

        if (\is_object($data) && $data instanceof \DateTimeInterface) {
            return $data->format(static::DATE_FORMAT);
        }

        if (\is_int($data)) {
            return (new \DateTime())->setTimestamp($data)->format(static::DATE_FORMAT);
        }

        if (\is_string($data) && $this->match($data)) {
            $sData = (string) $data;
            if ($this->checkDate($sData)) {
                return $sData;
            }
        }

        throw $this->newInvalidToUrl($data);
    }
694296
function processData(res, data, options) {
  const handlers = Object.assign({}, deserializers, options.deserializers);
  const contentType = res.headers['content-type'];
  const types = typeof contentType === 'string' ? contentType.split(';') : [];

  // if there are no content types, return the data unmodified
  if (!types.length) {
    return data;
  }

  return types.reduce((d, type) => {
    try {
      const t = type.toLocaleLowerCase().trim();
      const handler = handlers[t];

      if (d instanceof Error || typeof handler !== 'function') {
        return d;
      }
      return handler(d);
    } catch (error) {
      return error;
    }
  }, data);
}
1101752
function raw(callSite) {
	    var tpl = _toIobject(callSite.raw);
	    var len = _toLength(tpl.length);
	    var aLen = arguments.length;
	    var res = [];
	    var i = 0;
	    while (len > i) {
	      res.push(String(tpl[i++]));
	      if (i < aLen) res.push(String(arguments[i]));
	    }return res.join('');
	  }
931187
private JsonSimple parsedFormData(String oid) {
		// Get our data from Storage
		Payload payload = null;
		try {
			DigitalObject object = storage.getObject(oid);
			payload = getDataPayload(object);
		} catch (StorageException ex) {
			log.error("Error accessing object '{}' in storage: ", oid, ex);
			return null;
		}

		// Parse the JSON
		try {
			try {
				return FormDataParser.parse(payload.open());
			} catch (IOException ex) {
				log.error("Error parsing data '{}': ", oid, ex);
				return null;
			} finally {
				payload.close();
			}
		} catch (StorageException ex) {
			log.error("Error accessing data '{}' in storage: ", oid, ex);
			return null;
		}
	}
761460
public static RawData nl2br(Object data) {
        return new RawData(StringEscapeUtils.escapeHtml4(str(data)).replaceAll("(\\r\\n|\\n|\\r)", "<br/>"));
    }