@@ -491,22 +491,9 @@ var $Iterable = Iterable;
491
491
filterNot : function ( predicate , context ) {
492
492
return this . filter ( not ( predicate ) , context ) ;
493
493
} ,
494
- findKey : function ( predicate , context ) {
495
- var foundKey ;
496
- this . __iterate ( ( function ( v , k , c ) {
497
- if ( predicate . call ( context , v , k , c ) ) {
498
- foundKey = k ;
499
- return false ;
500
- }
501
- } ) ) ;
502
- return foundKey ;
503
- } ,
504
494
findLast : function ( predicate , context , notSetValue ) {
505
495
return this . toKeyedSeq ( ) . reverse ( ) . find ( predicate , context , notSetValue ) ;
506
496
} ,
507
- findLastKey : function ( predicate , context ) {
508
- return this . toKeyedSeq ( ) . reverse ( ) . findKey ( predicate , context ) ;
509
- } ,
510
497
first : function ( ) {
511
498
return this . find ( returnTrue ) ;
512
499
} ,
@@ -658,6 +645,27 @@ var KeyedIterable = function KeyedIterable(value) {
658
645
flip : function ( ) {
659
646
return reify ( this , flipFactory ( this ) ) ;
660
647
} ,
648
+ findKey : function ( predicate , context ) {
649
+ var foundKey ;
650
+ this . __iterate ( ( function ( v , k , c ) {
651
+ if ( predicate . call ( context , v , k , c ) ) {
652
+ foundKey = k ;
653
+ return false ;
654
+ }
655
+ } ) ) ;
656
+ return foundKey ;
657
+ } ,
658
+ findLastKey : function ( predicate , context ) {
659
+ return this . toSeq ( ) . reverse ( ) . findKey ( predicate , context ) ;
660
+ } ,
661
+ keyOf : function ( searchValue ) {
662
+ return this . findKey ( ( function ( value ) {
663
+ return is ( value , searchValue ) ;
664
+ } ) ) ;
665
+ } ,
666
+ lastKeyOf : function ( searchValue ) {
667
+ return this . toSeq ( ) . reverse ( ) . keyOf ( searchValue ) ;
668
+ } ,
661
669
mapEntries : function ( mapper , context ) {
662
670
var $__0 = this ;
663
671
var iterations = 0 ;
@@ -711,16 +719,16 @@ var IndexedIterable = function IndexedIterable(value) {
711
719
return reify ( this , filterFactory ( this , predicate , context , false ) ) ;
712
720
} ,
713
721
findIndex : function ( predicate , context ) {
714
- var key = this . findKey ( predicate , context ) ;
722
+ var key = this . toKeyedSeq ( ) . findKey ( predicate , context ) ;
715
723
return key === undefined ? - 1 : key ;
716
724
} ,
717
725
indexOf : function ( searchValue ) {
718
- return this . findIndex ( ( function ( value ) {
719
- return is ( value , searchValue ) ;
720
- } ) ) ;
726
+ var key = this . toKeyedSeq ( ) . keyOf ( searchValue ) ;
727
+ return key === undefined ? - 1 : key ;
721
728
} ,
722
729
lastIndexOf : function ( searchValue ) {
723
- return this . toKeyedSeq ( ) . reverse ( ) . indexOf ( searchValue ) ;
730
+ var key = this . toKeyedSeq ( ) . lastKeyOf ( searchValue ) ;
731
+ return key === undefined ? - 1 : key ;
724
732
} ,
725
733
reverse : function ( ) {
726
734
return reify ( this , reverseFactory ( this , false ) ) ;
@@ -736,7 +744,8 @@ var IndexedIterable = function IndexedIterable(value) {
736
744
return reify ( this , numArgs === 1 ? spliced : spliced . concat ( arrCopy ( arguments , 2 ) , this . slice ( index + removeNum ) ) ) ;
737
745
} ,
738
746
findLastIndex : function ( predicate , context ) {
739
- return this . toKeyedSeq ( ) . reverse ( ) . findIndex ( predicate , context ) ;
747
+ var key = this . toKeyedSeq ( ) . findLastKey ( predicate , context ) ;
748
+ return key === undefined ? - 1 : key ;
740
749
} ,
741
750
first : function ( ) {
742
751
return this . get ( 0 ) ;
0 commit comments