Skip to content

Commit 9f12c46

Browse files
dimircCameron Knight
authored and
Cameron Knight
committed
refactor($http): improve readability on conditional assignment
Use ternary operator instead of if statement Closes angular#5065
1 parent 1f2b759 commit 9f12c46

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/ng/http.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@ function parseHeaders(headers) {
1717
val = trim(line.substr(i + 1));
1818

1919
if (key) {
20-
if (parsed[key]) {
21-
parsed[key] += ', ' + val;
22-
} else {
23-
parsed[key] = val;
24-
}
20+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
2521
}
2622
});
2723

0 commit comments

Comments
 (0)