File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -90,9 +90,12 @@ function isArrayLike(obj) {
90
90
return true ;
91
91
}
92
92
93
- return isArray ( obj ) || ! isFunction ( obj ) && (
94
- length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj
95
- ) ;
93
+ if ( typeof obj !== 'object' ) {
94
+ return typeof obj === 'string' ;
95
+ }
96
+
97
+ return isArray ( obj ) || length === 0 ||
98
+ typeof length === "number" && length > 0 && ( length - 1 ) in obj ;
96
99
}
97
100
98
101
/**
Original file line number Diff line number Diff line change @@ -461,6 +461,13 @@ describe('angular', function() {
461
461
expect ( log ) . toEqual ( [ '0:a' , '1:b' , '2:c' ] ) ;
462
462
} ) ;
463
463
464
+ it ( 'should handle string values like arrays' , function ( ) {
465
+ var log = [ ] ;
466
+
467
+ forEach ( 'bar' , function ( value , key ) { log . push ( key + ':' + value ) } ) ;
468
+ expect ( log ) . toEqual ( [ '0:b' , '1:a' , '2:r' ] ) ;
469
+ } ) ;
470
+
464
471
465
472
it ( 'should handle objects with length property as objects' , function ( ) {
466
473
var obj = {
You can’t perform that action at this time.
0 commit comments