8000 use the correct terminology seq/iter/kind · spmjs/immutable-js@9a50e89 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9a50e89

Browse files
committed
use the correct terminology seq/iter/kind
1 parent 6eb2887 commit 9a50e89

File tree

3 files changed

+55
-59
lines changed

3 files changed

+55
-59
lines changed

dist/immutable.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -556,14 +556,14 @@ var $Iterable = Iterable;
556556
has: function(searchKey) {
557557
return this.get(searchKey, NOT_SET) !== NOT_SET;
558558
},
559-
isSubset: function(seq) {
560-
seq = typeof seq.contains === 'function' ? seq : $Iterable(seq);
559+
isSubset: function(iter) {
560+
iter = typeof iter.contains === 'function' ? iter : $Iterable(iter);
561561
return this.every((function(value) {
562-
return seq.contains(value);
562+
return iter.contains(value);
563563
}));
564564
},
565-
isSuperset: function(seq) {
566-
return seq.isSubset(this);
565+
isSuperset: function(iter) {
566+
return iter.isSubset(this);
567567
},
568568
keySeq: function() {
569569
return this.toSeq().map(keyMapper).toIndexedSeq();
@@ -575,21 +575,21 @@ var $Iterable = Iterable;
575575
return this.maxBy(valueMapper, comparator);
576576
},
577577
maxBy: function(mapper, comparator) {
578+
var $__0 = this;
578579
comparator = comparator || defaultComparator;
579-
var seq = this;
580-
var maxEntry = seq.entrySeq().reduce((function(max, next) {
581-
return comparator(mapper(next[1], next[0], seq), mapper(max[1], max[0], seq)) > 0 ? next : max;
580+
var maxEntry = this.entrySeq().reduce((function(max, next) {
581+
return comparator(mapper(next[1], next[0], $__0), mapper(max[1], max[0], $__0)) > 0 ? next : max;
582582
}));
583583
return maxEntry && maxEntry[1];
584584
},
585585
min: function(comparator) {
586586
return this.minBy(valueMapper, comparator);
587587
},
588588
minBy: function(mapper, comparator) {
589+
var $__0 = this;
589590
comparator = comparator || defaultComparator;
590-
var seq = this;
591-
var minEntry = seq.entrySeq().reduce((function(min, next) {
592-
return comparator(mapper(next[1], next[0], seq), mapper(min[1], min[0], seq)) < 0 ? next : min;
591+
var minEntry = this.entrySeq().reduce((function(min, next) {
592+
return comparator(mapper(next[1], next[0], $__0), mapper(min[1], min[0], $__0)) < 0 ? next : min;
593593
}));
594594
return minEntry && minEntry[1];
595595
},
@@ -609,10 +609,10 @@ var $Iterable = Iterable;
609609
return this.skipWhile(not(predicate), context);
610610
},
611611
sortBy: function(mapper, comparator) {
612+
var $__0 = this;
612613
comparator = comparator || defaultComparator;
613-
var seq = this;
614-
return reify(this, new ArraySequence(seq.entrySeq().entrySeq().toArray().sort((function(a, b) {
615-
return comparator(mapper(a[1][1], a[1][0], seq), mapper(b[1][1], b[1][0], seq)) || a[0] - b[0];
614+
return reify(this, new ArraySequence(this.entrySeq().entrySeq().toArray().sort((function(a, b) {
615+
return comparator(mapper(a[1][1], a[1][0], $__0), mapper(b[1][1], b[1][0], $__0)) || a[0] - b[0];
616616
}))).fromEntrySeq().valueSeq().fromEntrySeq());
617617
},
618618
take: function(amount) {
@@ -778,12 +778,12 @@ var IndexedIterable = function IndexedIterable(value) {
778778
return this.get(-1);
779779
},
780780
skip: function(amount) {
781-
var seq = this;
782-
var skipSeq = skipFactory(seq, amount, false);
783-
if (skipSeq !== seq) {
781+
var iter = this;
782+
var skipSe 6D47 q = skipFactory(iter, amount, false);
783+
if (isLazy(iter) && skipSeq !== iter) {
784784
skipSeq.get = function(index, notSetValue) {
785785
index = wrapIndex(this, index);
786-
return index >= 0 ? seq.get(index + amount, notSetValue) : notSetValue;
786+
return index >= 0 ? iter.get(index + amount, notSetValue) : notSetValue;
787787
};
788788
}
789789
return reify(this, skipSeq);
@@ -792,19 +792,19 @@ var IndexedIterable = function IndexedIterable(value) {
792792
return reify(this, skipWhileFactory(this, predicate, context, false));
793793
},
794794
sortBy: function(mapper, comparator) {
795+
var $__0 = this;
795796
comparator = comparator || defaultComparator;
796-
var seq = this;
797797
return reify(this, new ArraySequence(this.entrySeq().toArray().sort((function(a, b) {
798-
return comparator(mapper(a[1], a[0], seq), mapper(b[1], b[0], seq)) || a[0] - b[0];
798+
return comparator(mapper(a[1], a[0], $__0), mapper(b[1], b[0], $__0)) || a[0] - b[0];
799799
}))).fromEntrySeq().valueSeq());
800800
},
801801
take: function(amount) {
802-
var seq = this;
803-
var takeSeq = takeFactory(seq, amount);
804-
if (takeSeq !== seq) {
802+
var iter = this;
803+
var takeSeq = takeFactory(iter, amount);
804+
if (isLazy(iter) && takeSeq !== iter) {
805805
takeSeq.get = function(index, notSetValue) {
806806
index = wrapIndex(this, index);
807-
return index >= 0 && index < amount ? seq.get(index, notSetValue) : notSetValue;
807+
return index >= 0 && index < amount ? iter.get(index, notSetValue) : notSetValue;
808808
};
809809
}
810810
return reify(this, takeSeq);
@@ -831,8 +831,8 @@ Iterable.Keyed = KeyedIterable;
831831
Iterable.Set = SetIterable;
832832
Iterable.Indexed = IndexedIterable;
833833
Iterable.Iterator = Iterator;
834-
function reify(kind, seq) {
835-
return isLazy(kind) ? seq : kind.constructor(seq);
834+
function reify(iter, seq) {
835+
return isLazy(iter) ? seq : iter.constructor(seq);
836836
}
837837
function valueMapper(v) {
838838
return v;

0 commit comments

Comments
 (0)
0