Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e84c842

Browse files
author
Travis CI
committed
Deploy b29b484 to NPM branch
1 parent 865fa8b commit e84c842

File tree

3 files changed

+64
-34
lines changed

3 files changed

+64
-34
lines changed

dist/immutable.es.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,22 @@ function getIteratorFn(iterable) {
254254
var hasOwnProperty = Object.prototype.hasOwnProperty;
255255

256256
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+
);
258273
}
259274

260275
var Seq = (function (Collection$$1) {

dist/immutable.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,22 @@ function getIteratorFn(iterable) {
260260
var hasOwnProperty = Object.prototype.hasOwnProperty;
261261

262262
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+
);
264279
}
265280

266281
var Seq = (function (Collection$$1) {

0 commit comments

Comments
 (0)