mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-14 09:43:12 +00:00
refactor(ngRepeat): make use of declared variable
Rename unused arrayLength variable to arrayBound and use it inside loop
This commit is contained in:
parent
03bbe9aab1
commit
5ecd6d4e0a
1 changed files with 3 additions and 3 deletions
|
|
@ -96,7 +96,7 @@ var ngRepeatDirective = ngDirective({
|
||||||
// Same as lastOrder but it has the current state. It will become the
|
// Same as lastOrder but it has the current state. It will become the
|
||||||
// lastOrder on the next iteration.
|
// lastOrder on the next iteration.
|
||||||
nextOrder = new HashQueueMap(),
|
nextOrder = new HashQueueMap(),
|
||||||
arrayLength,
|
arrayBound,
|
||||||
childScope,
|
childScope,
|
||||||
key, value, // key/value of iteration
|
key, value, // key/value of iteration
|
||||||
array,
|
array,
|
||||||
|
|
@ -117,7 +117,7 @@ var ngRepeatDirective = ngDirective({
|
||||||
array = collection || [];
|
array = collection || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayLength = array.length;
|
arrayBound = array.length-1;
|
||||||
|
|
||||||
// we are not using forEach for perf reasons (trying to avoid #call)
|
// we are not using forEach for perf reasons (trying to avoid #call)
|
||||||
for (index = 0, length = array.length; index < length; index++) {
|
for (index = 0, length = array.length; index < length; index++) {
|
||||||
|
|
@ -154,7 +154,7 @@ var ngRepeatDirective = ngDirective({
|
||||||
childScope.$index = index;
|
childScope.$index = index;
|
||||||
|
|
||||||
childScope.$first = (index === 0);
|
childScope.$first = (index === 0);
|
||||||
childScope.$last = (index === (arrayLength - 1));
|
childScope.$last = (index === arrayBound);
|
||||||
childScope.$middle = !(childScope.$first || childScope.$last);
|
childScope.$middle = !(childScope.$first || childScope.$last);
|
||||||
|
|
||||||
if (!last) {
|
if (!last) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue