8000 rename flipIndices to reverseIndices · powercoder23/immutable-js@d90f6af · GitHub
[go: up one dir, main page]

Skip to content

Commit d90f6af

Browse files
committed
rename flipIndices to reverseIndices
1 parent 9e024c2 commit d90f6af

File tree

7 files changed

+82
-82
lines changed

7 files changed

+82
-82
lines changed

dist/Immutable.js

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,11 @@ var $Sequence = Sequence;
327327
var sequence = this;
328328
var valuesSequence = makeIndexedSequence(sequence);
329329
valuesSequence.length = sequence.length;
330-
valuesSequence.__iterateUncached = function(fn, reverse, flipIndices) {
330+
valuesSequence.__iterateUncached = function(fn, reverse, reverseIndices) {
331331
var $__0 = this;
332332
var iterations = 0;
333333
var predicate;
334-
if (flipIndices) {
334+
if (reverseIndices) {
335335
var maxIndex = this.length - 1;
336336
predicate = (function(v, k, c) {
337337
return fn(v, maxIndex - iterations++, $__0) !== false;
@@ -512,10 +512,10 @@ var $Sequence = Sequence;
512512
return sequence;
513513
}
514514
var takeSequence = sequence.__makeSequence();
515-
takeSequence.__iterateUncached = function(fn, reverse, flipIndices) {
515+
takeSequence.__iterateUncached = function(fn, reverse, reverseIndices) {
516516
var $__0 = this;
517517
if (reverse) {
518-
return this.cacheResult().__iterate(fn, reverse, flipIndices);
518+
return this.cacheResult().__iterate(fn, reverse, reverseIndices);
519519
}
520520
var iterations = 0;
521521
sequence.__iterate((function(v, k) {
@@ -532,10 +532,10 @@ var $Sequence = Sequence;
532532
takeWhile: function(predicate, thisArg) {
533533
var sequence = this;
534534
var takeSequence = sequence.__makeSequence();
535-
takeSequence.__iterateUncached = function(fn, reverse, flipIndices) {
535+
takeSequence.__iterateUncached = function(fn, reverse, reverseIndices) {
536536
var $__0 = this;
537537
if (reverse) {
538-
return this.cacheResult().__iterate(fn, reverse, flipIndices);
538+
return this.cacheResult().__iterate(fn, reverse, reverseIndices);
539539
}
540540
var iterations = 0;
541541
sequence.__iterate((function(v, k, c) {
@@ -686,11 +686,11 @@ var $IndexedSequence = IndexedSequence;
686686
return sequence;
687687
});
688688
reversedSequence.length = sequence.length;
689-
reversedSequence.__iterateUncached = function(fn, reverse, flipIndices) {
689+
reversedSequence.__iterateUncached = function(fn, reverse, reverseIndices) {
690690
var $__0 = this;
691-
var i = flipIndices ? this.length : 0;
691+
var i = reverseIndices ? this.length : 0;
692692
return sequence.__iterate((function(v) {
693-
return fn(v, flipIndices ? --i : i++, $__0) !== false;
693+
return fn(v, reverseIndices ? --i : i++, $__0) !== false;
694694
}), !reverse);
695695
};
696696
return reversedSequence;
@@ -732,14 +732,14 @@ var $IndexedSequence = IndexedSequence;
732732
flatten: function() {
733733
var sequence = this;
734734
var flatSequence = this.__makeSequence();
735-
flatSequence.__iterateUncached = function(fn, reverse, flipIndices) {
735+
flatSequence.__iterateUncached = function(fn, reverse, reverseIndices) {
736736
var $__0 = this;
737737
var iterations = 0;
738738
var maxIndex = this.length - 1;
739739
sequence.__iterate((function(seq) {
740740
var stopped = false;
741741
Sequence(seq).__iterate((function(v) {
742-
if (fn(v, flipIndices ? maxIndex - iterations++ : iterations++, $__0) === false) {
742+
if (fn(v, reverseIndices ? maxIndex - iterations++ : iterations++, $__0) === false) {
743743
stopped = true;
744744
return false;
745745
}
@@ -769,24 +769,24 @@ var $IndexedSequence = IndexedSequence;
769769
return comparator(mapper(a[1], a[0], seq), mapper(b[1], b[0], seq)) || a[0] - b[0];
770770
}))).fromEntrySeq().valueSeq();
771771
},
772-
__iterate: function(fn, reverse, flipIndices) {
772+
__iterate: function(fn, reverse, reverseIndices) {
773773
var cache = this._cache;
774774
if (cache) {
775-
flipIndices ^= reverse;
775+
reverseIndices ^= reverse;
776776
var maxIndex = cache.length - 1;
777777
for (var ii = 0; ii <= maxIndex; ii++) {
778778
var entry = cache[reverse ? maxIndex - ii : ii];
779779
var key = entry[0];
780-
if (fn(entry[1], flipIndices ? maxIndex - key : key, this) === false) {
780+
if (fn(entry[1], reverseIndices ? maxIndex - key : key, this) === false) {
781781
break;
782782
}
783783
}
784784
return ii;
785785
}
786-
if (flipIndices && !this.length) {
787-
return this.cacheResult().__iterate(fn, reverse, flipIndices);
786+
if (reverseIndices && !this.length) {
787+
return this.cacheResult().__iterate(fn, reverse, reverseIndices);
788788
}
789-
return this.__iterateUncached(fn, reverse, flipIndices);
789+
return this.__iterateUncached(fn, reverse, reverseIndices);
790790
},
791791
__makeSequence: function() {
792792
return makeIndexedSequence(this);
@@ -858,15 +858,15 @@ var ArraySequence = function ArraySequence(array) {
858858
index = wrapIndex(this, index);
859859
return index >= 0 && index < this.length;
860860
},
861-
__iterate: function(fn, reverse, flipIndices) {
861+
__iterate: function(fn, reverse, reverseIndices) {
862862
var array = this._array;
863863
var maxIndex = array.length - 1;
864864
var ii,
865865
rr;
866-
var reversedIndices = reverse ^ flipIndices;
866+
var reversedIndices = reverse ^ reverseIndices;
867867
for (ii = 0; ii <= maxIndex; ii++) {
868868
rr = maxIndex - ii;
869-
if (fn(array[reverse ? rr : ii], flipIndices ? rr : ii, array) === false) {
869+
if (fn(array[reverse ? rr : ii], reverseIndices ? rr : ii, array) === false) {
870870
return reversedIndices ? reverse ? rr : ii : array.length;
871871
}
872872
}
@@ -927,7 +927,7 @@ function increment(value) {
927927
}
928928
function filterFactory(sequence, pred 10000 icate, context, useKeys) {
929929
var filterSequence = sequence.__makeSequence();
930-
filterSequence.__iterateUncached = function(fn, reverse, flipIndices) {
930+
filterSequence.__iterateUncached = function(fn, reverse, reverseIndices) {
931931
var $__0 = this;
932932
var iterations = 0;
933933
sequence.__iterate((function(v, k, c) {
@@ -963,10 +963,10 @@ function skipFactory(sequence, amount, useKeys) {
963963
return sequence;
964964
}
965965
var skipSequence = sequence.__makeSequence();
966-
skipSequence.__iterateUncached = function(fn, reverse, flipIndices) {
966+
skipSequence.__iterateUncached = function(fn, reverse, reverseIndices) {
967967
var $__0 = this;
968968
if (reverse) {
969-
return this.cacheResult().__iterate(fn, reverse, flipIndices);
969+
return this.cacheResult().__iterate(fn, reverse, reverseIndices);
970970
}
971971
var skipped = 0;
972972
var isSkipping = true;
@@ -984,10 +984,10 @@ function skipFactory(sequence, amount, useKeys) {
984984
}
985985
function skipWhileFactory(sequence, predicate, thisArg, useKeys) {
986986
var skipSequence = sequence.__makeSequence();
987-
skipSequence.__iterateUncached = function(fn, reverse, flipIndices) {
987+
skipSequence.__iterateUncached = function(fn, reverse, reverseIndices) {
988988
var $__0 = this;
989989
if (reverse) {
990-
return this.cacheResult().__iterate(fn, reverse, flipIndices);
990+
return this.cacheResult().__iterate(fn, reverse, reverseIndices);
991991
}
992992
var isSkipping = true;
993993
var iterations = 0;
@@ -1081,12 +1081,12 @@ var Cursor = function Cursor(rootData, keyPath, onChange, value) {
10811081
cursor: function(subKey) {
10821082
return Array.isArray(subKey) && subKey.length === 0 ? this : subCursor(this, subKey);
10831083
},
1084-
__iterate: function(fn, reverse, flipIndices) {
1084+
__iterate: function(fn, reverse, reverseIndices) {
10851085
var cursor = this;
10861086
var deref = cursor.deref();
10871087
return deref && deref.__iterate ? deref.__iterate((function(value, key, collection) {
10881088
return fn(wrappedValue(cursor, key, value), key, collection);
1089-
}), reverse, flipIndices) : 0;
1089+
}), reverse, reverseIndices) : 0;
10901090
}
10911091
}, {}, Sequence);
10921092
Cursor.prototype[DELETE] = Cursor.prototype.remove;
@@ -1800,16 +1800,16 @@ var $Vector = Vector;
18001800
entries: function() {
18011801
return new VectorIterator(this, 2);
18021802
},
1803-
__iterator: function(reverse, flipIndices) {
1804-
return new VectorIterator(this, 2, reverse, flipIndices);
1803+
__iterator: function(reverse, reverseIndices) {
1804+
return new VectorIterator(this, 2, reverse, reverseIndices);
18051805
},
1806-
__iterate: function(fn, reverse, flipIndices) {
1806+
__iterate: function(fn, reverse, reverseIndices) {
18071807
var vector = this;
18081808
var lastIndex = 0;
18091809
var maxIndex = vector.length - 1;
1810-
flipIndices ^= reverse;
1810+
reverseIndices ^= reverse;
18111811
var eachFn = (function(value, ii) {
1812-
if (fn(value, flipIndices ? maxIndex - ii : ii, vector) === false) {
1812+
if (fn(value, reverseIndices ? maxIndex - ii : ii, vector) === false) {
18131813
return false;
18141814
} else {
18151815
lastIndex = ii;
@@ -1974,10 +1974,10 @@ function iterateVNode(node, level, offset, max, fn, reverse) {
19741974
}
19751975
return true;
19761976
}
1977-
var VectorIterator = function VectorIterator(vector, type, reverse, flipIndices) {
1977+
var VectorIterator = function VectorIterator(vector, type, reverse, reverseIndices) {
19781978
this._type = type;
19791979
this._reverse = !!reverse;
1980-
this._flipIndices = !!(flipIndices ^ reverse);
1980+
this._reverseIndices = !!(reverseIndices ^ reverse);
19811981
this._maxIndex = vector.length - 1;
19821982
var tailOffset = getTailOffset(vector._size);
19831983
var rootStack = vectIteratorFrame(vector._root && vector._root.array, vector._level, -vector._origin, tailOffset - vector._origin - 1);
@@ -2004,7 +2004,7 @@ var VectorIterator = function VectorIterator(vector, type, reverse, flipIndices)
20042004
var index;
20052005
if (type !== 1) {
20062006
index = stack.offset + (rawIndex << stack.level);
2007-
if (this._flipIndices) {
2007+
if (this._reverseIndices) {
20082008
index = this._maxIndex - index;
20092009
}
20102010
}
@@ -2716,12 +2716,12 @@ var $Range = Range;
27162716
skip: function(amount) {
27172717
return this.slice(amount);
27182718
},
2719-
__iterate: function(fn, reverse, flipIndices) {
2719+
__iterate: function(fn, reverse, reverseIndices) {
27202720
var maxIndex = this.length - 1;
27212721
var step = this._step;
27222722
var value = reverse ? this._start + maxIndex * step : this._start;
27232723
for (var ii = 0; ii <= maxIndex; ii++) {
2724-
if (fn(value, flipIndices ? maxIndex - ii : ii, this) === false) {
2724+
if (fn(value, reverseIndices ? maxIndex - ii : ii, this) === false) {
27252725
break;
27262726
}
27272727
value += reverse ? -step : step;
@@ -2788,11 +2788,11 @@ var $Repeat = Repeat;
27882788
}
27892789
return -1;
27902790
},
2791-
__iterate: function(fn, reverse, flipIndices) {
2792-
invariant(!flipIndices || this.length < Infinity, 'Cannot access end of infinite range.');
2791+
__iterate: function(fn, reverse, reverseIndices) {
2792+
invariant(!reverseIndices || this.length < Infinity, 'Cannot access end of infinite range.');
27932793
var maxIndex = this.length - 1;
27942794
for (var ii = 0; ii <= maxIndex; ii++) {
2795-
if (fn(this._value, flipIndices ? maxIndex - ii : ii, this) === false) {
2795+
if (fn(this._value, reverseIndices ? maxIndex - ii : ii, this) === false) {
27962796
break;
27972797
}
27982798
}

0 commit comments

Comments
 (0)
0