Skip to content

Commit

Permalink
refactor(ngRepeat): make use of declared variable
Browse files Browse the repository at this point in the history
Rename unused arrayLength variable to arrayBound and use it inside loop
  • Loading branch information
mchapman authored and jbdeboer committed Mar 20, 2013
1 parent 821d2fd commit 4efda14
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ng/directive/ngRepeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ var ngRepeatDirective = ngDirective({
// Same as lastOrder but it has the current state. It will become the
// lastOrder on the next iteration.
nextOrder = new HashQueueMap(),
arrayLength,
arrayBound,
childScope,
key, value, // key/value of iteration
array,
Expand All @@ -117,7 +117,7 @@ var ngRepeatDirective = ngDirective({
array = collection || [];
}

arrayLength = array.length;
arrayBound = array.length-1;

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

childScope.$first = (index === 0);
childScope.$last = (index === (arrayLength - 1));
childScope.$last = (index === arrayBound);
childScope.$middle = !(childScope.$first || childScope.$last);

if (!last) {
Expand Down

0 comments on commit 4efda14

Please sign in to comment.