jquery
Version:
JavaScript library for DOM operations
16 lines (11 loc) • 374 B
JavaScript
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;
}