You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
350 B
16 lines
350 B
/**
|
|
* @description: 判断是否为类数组
|
|
* @param {*} o
|
|
* @return {boolean}
|
|
* @example isArrayLike({0:1,1:2,length:2}) // true
|
|
*/
|
|
export default function isArrayLike(o) {
|
|
return (
|
|
o &&
|
|
typeof o === 'object' &&
|
|
isFinite(o.length) &&
|
|
o.length >= 0 &&
|
|
o.length === Math.floor(o.length) &&
|
|
o.length < 4294967296
|
|
);
|
|
}
|
|
|