@@ -444,10 +444,16 @@ var $Sequence = Sequence;
444
444
} ) , null , notSetValue ) ;
445
445
} ,
446
446
getIn : function ( searchKeyPath , notSetValue ) {
447
- if ( ! searchKeyPath || searchKeyPath . length === 0 ) {
448
- return this ;
447
+ var nested = this ;
448
+ if ( searchKeyPath ) {
449
+ for ( var ii = 0 ; ii < searchKeyPath . length ; ii ++ ) {
450
+ nested = nested && nested . get ? nested . get ( searchKeyPath [ ii ] , NOT_SET ) : NOT_SET ;
451
+ if ( nested === NOT_SET ) {
452
+ return notSetValue ;
453
+ }
454
+ }
449
455
}
450
- return getInDeepSequence ( this , searchKeyPath , notSetValue , 0 ) ;
456
+ return nested ;
451
457
} ,
452
458
contains : function ( searchValue ) {
453
459
return this . find ( ( function ( value ) {
@@ -921,16 +927,6 @@ function makeSequence() {
921
927
function makeIndexedSequence ( parent ) {
922
928
return Object . create ( IndexedSequencePrototype ) ;
923
929
}
924
- function getInDeepSequence ( seq , keyPath , notSetValue , pathOffset ) {
925
- var nested = seq . get ? seq . get ( keyPath [ pathOffset ] , NOT_SET ) : NOT_SET ;
926
- if ( nested === NOT_SET ) {
927
- return notSetValue ;
928
- }
929
- if ( ++ pathOffset === keyPath . length ) {
930
- return nested ;
931
- }
932
- return getInDeepSequence ( nested , keyPath , notSetValue , pathOffset ) ;
933
- }
934
930
function wholeSlice ( begin , end , length ) {
935
931
return ( begin === 0 || ( length != null && begin <= - length ) ) && ( end == null || ( length != null && end >= length ) ) ;
936
932
}
0 commit comments