Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
fix: uses Object.assign instead of spreading
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-zakharchenko committed Jul 17, 2019
1 parent d9eaba1 commit 9ed4f62
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 41 deletions.
14 changes: 7 additions & 7 deletions lib/units/normalize/normalizeHeaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ const normalizeHeaders = (headers) => {
}

return Object.keys(headers).reduce(
(normalizedHeaders, name) => ({
...normalizedHeaders,
[name.toLowerCase()]:
typeof headers[name] === 'string'
? normalizeStringValue(headers[name])
: headers[name]
}),
(normalizedHeaders, name) =>
Object.assign({}, normalizedHeaders, {
[name.toLowerCase()]:
typeof headers[name] === 'string'
? normalizeStringValue(headers[name])
: headers[name]
}),
{}
);
};
Expand Down
4 changes: 3 additions & 1 deletion lib/utils/evolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ const evolve = (schema, { strict = false } = {}) => (data) => {
: value;
/* eslint-enable no-nested-ternary */

return isArray ? acc.concat(nextValue) : { ...acc, [key]: nextValue };
return isArray
? acc.concat(nextValue)
: Object.assign({}, acc, { [key]: nextValue });
};

const nextData = Object.keys(data).reduce(reducer, result);
Expand Down
41 changes: 11 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions test/cucumber/support/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ Make sure it's in the "Header-Name: value" format.

const [_, key, value] = match;

return {
...acc,
return Object.assign({}, acc, {
[key.toLowerCase()]: value.trim()
};
});
}, {});
return headers;
}
Expand Down

0 comments on commit 9ed4f62

Please sign in to comment.