MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / parseHeaders

Function parseHeaders

lib/test/angular/1.4.3/angular.js:9267–9288  ·  view source on GitHub ↗

* Parse headers into key value object * * @param {string} headers Raw headers as a string * @returns {Object} Parsed headers as key value object

(headers)

Source from the content-addressed store, hash-verified

9265 * @returns {Object} Parsed headers as key value object
9266 */
9267function parseHeaders(headers) {
9268 var parsed = createMap(), i;
9269
9270 function fillInParsed(key, val) {
9271 if (key) {
9272 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
9273 }
9274 }
9275
9276 if (isString(headers)) {
9277 forEach(headers.split('\n'), function(line) {
9278 i = line.indexOf(':');
9279 fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1)));
9280 });
9281 } else if (isObject(headers)) {
9282 forEach(headers, function(headerVal, headerKey) {
9283 fillInParsed(lowercase(headerKey), trim(headerVal));
9284 });
9285 }
9286
9287 return parsed;
9288}
9289
9290
9291/**

Callers 2

headersGetterFunction · 0.70
doneFunction · 0.70

Calls 7

createMapFunction · 0.70
isStringFunction · 0.70
forEachFunction · 0.70
fillInParsedFunction · 0.70
lowercaseFunction · 0.70
trimFunction · 0.70
isObjectFunction · 0.70

Tested by

no test coverage detected