diff --git a/src/utils/isArrayLike.js b/src/utils/isArrayLike.js index 1fa20b20f6..90eecb0eb4 100644 --- a/src/utils/isArrayLike.js +++ b/src/utils/isArrayLike.js @@ -13,13 +13,8 @@ export default function isArrayLike(value) { return ( value && typeof value === 'object' && - Number.isInteger(value.length) && - value.length >= 0 && - (value.length === 0 - ? // Only {length: 0} is considered Array-like. - Object.keys(value).length === 1 - : // An object is only Array-like if it has a property where the last value - // in the array-like may be found (which could be undefined). - value.hasOwnProperty(value.length - 1)) + typeof value.length === 'number' && + ((value.length && value.length - 1 in value) || + (!value.length && Object.keys(value).length <= 1)) ); }