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

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;
}

export default isArrayLike;