Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 37cec7a

Browse files
committed
refactor(ngClass): exit arrayDifference() early if an input is empty
1 parent a7e69f7 commit 37cec7a

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
@@ -101,6 +101,9 @@ function classDirective(name, selector) {
101101

102102
// Helpers
103103
function arrayDifference(tokens1, tokens2) {
104+
if (!tokens1 || !tokens1.length) return [];
105+
if (!tokens2 || !tokens2.length) return tokens1;
106+
104107
var values = [];
105108

106109
outer:
@@ -111,6 +114,7 @@ function classDirective(name, selector) {
111114
}
112115
values.push(token);
113116
}
117+
114118
return values;
115119
}
116120

0 commit comments

Comments
 (0)