@@ -556,14 +556,14 @@ var $Iterable = Iterable;
556
556
has : function ( searchKey ) {
557
557
return this . get ( searchKey , NOT_SET ) !== NOT_SET ;
558
558
} ,
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 ) ;
561
561
return this . every ( ( function ( value ) {
562
- return seq . contains ( value ) ;
562
+ return iter . contains ( value ) ;
563
563
} ) ) ;
564
564
} ,
565
- isSuperset : function ( seq ) {
566
- return seq . isSubset ( this ) ;
565
+ isSuperset : function ( iter ) {
566
+ return iter . isSubset ( this ) ;
567
567
} ,
568
568
keySeq : function ( ) {
569
569
return this . toSeq ( ) . map ( keyMapper ) . toIndexedSeq ( ) ;
@@ -575,21 +575,21 @@ var $Iterable = Iterable;
575
575
return this . maxBy ( valueMapper , comparator ) ;
576
576
} ,
577
577
maxBy : function ( mapper , comparator ) {
578
+ var $__0 = this ;
578
579
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 ;
582
582
} ) ) ;
583
583
return maxEntry && maxEntry [ 1 ] ;
584
584
} ,
585
585
min : function ( comparator ) {
586
586
return this . minBy ( valueMapper , comparator ) ;
587
587
} ,
588
588
minBy : function ( mapper , comparator ) {
589
+ var $__0 = this ;
589
590
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 ;
593
593
} ) ) ;
594
594
return minEntry && minEntry [ 1 ] ;
595
595
} ,
@@ -609,10 +609,10 @@ var $Iterable = Iterable;
609
609
return this . skipWhile ( not ( predicate ) , context ) ;
610
610
} ,
611
611
sortBy : function ( mapper , comparator ) {
612
+ var $__0 = this ;
612
613
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 ] ;
616
616
} ) ) ) . fromEntrySeq ( ) . valueSeq ( ) . fromEntrySeq ( ) ) ;
617
617
} ,
618
618
take : function ( amount ) {
@@ -778,12 +778,12 @@ var IndexedIterable = function IndexedIterable(value) {
778
778
return this . get ( - 1 ) ;
779
779
} ,
780
780
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 ) {
784
784
skipSeq . get = function ( index , notSetValue ) {
785
785
index = wrapIndex ( this , index ) ;
786
- return index >= 0 ? seq . get ( index + amount , notSetValue ) : notSetValue ;
786
+ return index >= 0 ? iter . get ( index + amount , notSetValue ) : notSetValue ;
787
787
} ;
788
788
}
789
789
return reify ( this , skipSeq ) ;
@@ -792,19 +792,19 @@ var IndexedIterable = function IndexedIterable(value) {
792
792
return reify ( this , skipWhileFactory ( this , predicate , context , false ) ) ;
793
793
} ,
794
794
sortBy : function ( mapper , comparator ) {
795
+ var $__0 = this ;
795
796
comparator = comparator || defaultComparator ;
796
- var seq = this ;
797
797
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 ] ;
799
799
} ) ) ) . fromEntrySeq ( ) . valueSeq ( ) ) ;
800
800
} ,
801
801
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 ) {
805
805
takeSeq . get = function ( index , notSetValue ) {
806
806
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 ;
808
808
} ;
809
809
}
810
810
return reify ( this , takeSeq ) ;
@@ -831,8 +831,8 @@ Iterable.Keyed = KeyedIterable;
831
831
Iterable . Set = SetIterable ;
832
832
Iterable . Indexed = IndexedIterable ;
833
833
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 ) ;
836
836
}
837
837
function valueMapper ( v ) {
838
838
return v ;
0 commit comments