aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/isArrayLike.js
blob: bc24b32f4529880101a0562087c34cc291b97435 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { toType } from "./toType.js";
import { isWindow } from "../var/isWindow.js";

export function isArrayLike( obj ) {

	var length = !!obj && obj.length,
		type = toType( obj );

	if ( typeof obj === "function" || isWindow( obj ) ) {
		return false;
	}

	return type === "array" || length === 0 ||
		typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}