Skip to content

Commit

Permalink
Make array concatenation more concise.
Browse files Browse the repository at this point in the history
  • Loading branch information
kompot committed Apr 6, 2017
1 parent c2a4b20 commit 5f08fab
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/helpers/parseHeaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ module.exports = function parseHeaders(headers) {

if (key) {
if (parsed[key]) {
parsed[key] = utils.isArray(parsed[key])
// third+ value with that key
? parsed[key].concat(val)
// second value with that key
: [parsed[key]].concat(val);
parsed[key] = [].concat(parsed[key], val);
} else {
parsed[key] = val;
}
Expand Down

0 comments on commit 5f08fab

Please sign in to comment.