Skip to content

Commit 4efda14

Browse files
mchapmanjbdeboer
authored andcommitted
refactor(ngRepeat): make use of declared variable
Rename unused arrayLength variable to arrayBound and use it inside loop
1 parent 821d2fd commit 4efda14

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ng/directive/ngRepeat.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ var ngRepeatDirective = ngDirective({
9696
// Same as lastOrder but it has the current state. It will become the
9797
// lastOrder on the next iteration.
9898
nextOrder = new HashQueueMap(),
99-
arrayLength,
99+
arrayBound,
100100
childScope,
101101
key, value, // key/value of iteration
102102
array,
@@ -117,7 +117,7 @@ var ngRepeatDirective = ngDirective({
117117
array = collection || [];
118118
}
119119

120-
arrayLength = array.length;
120+
arrayBound = array.length-1;
121121

122122
// we are not using forEach for perf reasons (trying to avoid #call)
123123
for (index = 0, length = array.length; index < length; index++) {
@@ -154,7 +154,7 @@ var ngRepeatDirective = ngDirective({
154154
childScope.$index = index;
155155

156156
childScope.$first = (index === 0);
157-
childScope.$last = (index === (arrayLength - 1));
157+
childScope.$last = (index === arrayBound);
158158
childScope.$middle = !(childScope.$first || childScope.$last);
159159

160160
if (!last) {

0 commit comments

Comments
 (0)