/
githubmirror
/
immutable-js
Обзор
Документация
Войти
/
githubmirror
/
immutable-js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v4.3.9
src/utils/isArrayLike.js
18 строк
571 B
Lee Byron
Relicence and copyright (#1814)
18 июн 2021, 01:53
Не верифицирован
18 июн 2021, 01:53
5155a7f
Код
Авторство
О чём код?
export default function isArrayLike(value) { if (Array.isArray(value) || typeof value === 'string') { return true; } 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)) ); }