Skip to content

Commit 709a452

Browse files
author
Stanislav Idolov
authored
ENGCOM-1030: [Forwardport] Fix JS address converter function from mutating its argument #14250
2 parents 4a083d1 + 24d8da3 commit 709a452

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

app/code/Magento/Checkout/view/frontend/web/js/model/address-converter.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,20 @@ define([
7272
output = {},
7373
streetObject;
7474

75+
$.each(addrs, function (key) {
76+
if (addrs.hasOwnProperty(key) && !$.isFunction(addrs[key])) {
77+
output[self.toUnderscore(key)] = addrs[key];
78+
}
79+
});
80+
7581
if ($.isArray(addrs.street)) {
7682
streetObject = {};
7783
addrs.street.forEach(function (value, index) {
7884
streetObject[index] = value;
7985
});
80-
addrs.street = streetObject;
86+
output.street = streetObject;
8187
}
8288

83-
$.each(addrs, function (key) {
84-
if (addrs.hasOwnProperty(key) && !$.isFunction(addrs[key])) {
85-
output[self.toUnderscore(key)] = addrs[key];
86-
}
87-
});
88-
8989
return output;
9090
},
9191

0 commit comments

Comments
 (0)