Skip to content

Commit 7319bd3

Browse files
committed
refactor(ngClass): exit arrayDifference() early if an input is empty
1 parent 9bb43ba commit 7319bd3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/ng/directive/ngClass.js

+4
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ function classDirective(name, selector) {
104104

105105
// Helpers
106106
function arrayDifference(tokens1, tokens2) {
107+
if (!tokens1 || !tokens1.length) return [];
108+
if (!tokens2 || !tokens2.length) return tokens1;
109+
107110
var values = [];
108111

109112
outer:
@@ -114,6 +117,7 @@ function classDirective(name, selector) {
114117
}
115118
values.push(token);
116119
}
120+
117121
return values;
118122
}
119123

0 commit comments

Comments
 (0)