Skip to content

Commit e6c5631

Browse files
timtuckercrissdev
authored andcommitted
Only get types once in mergeArrays
Make a max of 2 calls to exports.getType instead of 4 calls.
1 parent f97d5cd commit e6c5631

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

dist/knockout.mapping.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,18 @@
253253
}
254254

255255
function mergeArrays(a, b) {
256-
if (exports.getType(a) !== "array") {
257-
if (exports.getType(a) === "undefined") a = [];
258-
else a = [a];
256+
if (a === undefined) {
257+
a = [];
259258
}
260-
if (exports.getType(b) !== "array") {
261-
if (exports.getType(b) === "undefined") b = [];
262-
else b = [b];
259+
else if (exports.getType(a) !== "array") {
260+
a = [a];
261+
}
262+
263+
if (b === undefined) {
264+
b = [];
265+
}
266+
else if (exports.getType(b) !== "array") {
267+
b = [b];
263268
}
264269

265270
return ko.utils.arrayGetDistinctValues(a.concat(b));

dist/knockout.mapping.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/knockout.mapping.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)