File tree 3 files changed +64
-34
lines changed
3 files changed +64
-34
lines changed Original file line number Diff line number Diff line change @@ -254,7 +254,22 @@ function getIteratorFn(iterable) {
254
254
var hasOwnProperty = Object . prototype . hasOwnProperty ;
255
255
256
256
function isArrayLike ( value ) {
257
- return value && typeof value . length === 'number' ;
257
+ if ( Array . isArray ( value ) || typeof value === 'string' ) {
258
+ return true ;
259
+ }
260
+
261
+ return (
262
+ value &&
263
+ typeof value === 'object' &&
264
+ Number . isInteger ( value . length ) &&
265
+ value . length >= 0 &&
266
+ ( value . length === 0
267
+ ? // Only {length: 0} is considered Array-like.
268
+ Object . keys ( value ) . length === 1
269
+ : // An object is only Array-like if it has a property where the last value
270
+ // in the array-like may be found (which could be undefined).
271
+ value . hasOwnProperty ( value . length - 1 ) )
272
+ ) ;
258
273
}
259
274
260
275
var Seq = ( function ( Collection$$1 ) {
Original file line number Diff line number Diff line change @@ -260,7 +260,22 @@ function getIteratorFn(iterable) {
260
260
var hasOwnProperty = Object . prototype . hasOwnProperty ;
261
261
262
262
function isArrayLike ( value ) {
263
- return value && typeof value . length === 'number' ;
263
+ if ( Array . isArray ( value ) || typeof value === 'string' ) {
264
+ return true ;
265
+ }
266
+
267
+ return (
268
+ value &&
269
+ typeof value === 'object' &&
270
+ Number . isInteger ( value . length ) &&
271
+ value . length >= 0 &&
272
+ ( value . length === 0
273
+ ? // Only {length: 0} is considered Array-like.
274
+ Object . keys ( value ) . length === 1
275
+ : // An object is only Array-like if it has a property where the last value
276
+ // in the array-like may be found (which could be undefined).
277
+ value . hasOwnProperty ( value . length - 1 ) )
278
+ ) ;
264
279
}
265
280
266
281
var Seq = ( function ( Collection$$1 ) {
You can’t perform that action at this time.
0 commit comments