Use faster loop to handle prioritize in Base.filter()

This commit is contained in:
Jürg Lehni 2016-07-26 10:20:30 +02:00
parent 3f76bd99ef
commit 34c57a47fa

View file

@ -351,12 +351,12 @@ Base.inject(/** @lends Base# */{
// If there are prioritized keys, process them first. // If there are prioritized keys, process them first.
if (prioritize) { if (prioritize) {
var keys = {}; var keys = {};
prioritize.forEach(function(key) { for (var i = 0, key, l = prioritize.length; i < l; i++) {
if (key in source) { if ((key = prioritize[i]) in source) {
handleKey(key); handleKey(key);
keys[key] = true; keys[key] = true;
} }
}); }
// Now reference the processed keys as processed, so that // Now reference the processed keys as processed, so that
// handleKey() will not set them again below. // handleKey() will not set them again below.
processed = keys; processed = keys;