File tree 2 files changed +15
-4
lines changed
2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -232,8 +232,7 @@ function isArrayLike(obj) {
232
232
233
233
// NodeList objects (with `item` method) and
234
234
// other objects with suitable length characteristics are array-like
235
- return isNumber ( length ) &&
236
- ( length >= 0 && ( ( length - 1 ) in obj || obj instanceof Array ) || typeof obj . item === 'function' ) ;
235
+ return isNumber ( length ) && ( length >= 0 && ( length - 1 ) in obj || typeof obj . item === 'function' ) ;
237
236
238
237
}
239
238
@@ -634,12 +633,14 @@ function isDate(value) {
634
633
* @kind function
635
634
*
636
635
* @description
637
- * Determines if a reference is an `Array`. Alias of Array.isArray.
636
+ * Determines if a reference is an `Array`.
638
637
*
639
638
* @param {* } value Reference to check.
640
639
* @returns {boolean } True if `value` is an `Array`.
641
640
*/
642
- var isArray = Array . isArray ;
641
+ function isArray ( arr ) {
642
+ return arr instanceof Array || Array . isArray ( arr ) ;
643
+ }
643
644
644
645
/**
645
646
* @ngdoc function
Original file line number Diff line number Diff line change @@ -1226,6 +1226,16 @@ describe('angular', function() {
1226
1226
} ) ;
1227
1227
} ) ;
1228
1228
1229
+ describe ( 'isArray' , function ( ) {
1230
+
1231
+ it ( 'should return true if passed an object prototypically inherited from Array.prototype' , function ( ) {
1232
+ function FooArray ( ) { }
1233
+ FooArray . prototype = [ ] ;
1234
+ expect ( isArray ( new FooArray ( ) ) ) . toBe ( true ) ;
1235
+ } ) ;
1236
+
1237
+ } ) ;
1238
+
1229
1239
describe ( 'isArrayLike' , function ( ) {
1230
1240
1231
1241
it ( 'should return false if passed a number' , function ( ) {
You can’t perform that action at this time.
0 commit comments