When Lodash isArrayLikeObject Rejects a NodeList

By default, the Lodash utility method _.isArrayLikeObject returns true when evaluated against a standard DOM NodeList because it is a non-null object featuring an integer-based length property. For _.isArrayLikeObject to reject a NodeList and return false, the instance must fail either Lodash's internal isObjectLike check or its isArrayLike check. Below are the precise technical conditions required for rejection.

How _.isArrayLikeObject Evaluates Values

Lodash defines _.isArrayLikeObject as:

function isArrayLikeObject(value) {
  return isObjectLike(value) && isArrayLike(value);
}

A standard NodeList normally satisfies both prerequisites:

Explicit Rejection Conditions

For a DOM NodeList to return false, one of the following explicit conditions must be met:

1. The length Property Fails isLength Validation

Lodash validates the length property using the internal isLength(value) predicate. A NodeList will be rejected if its .length property is tampered with or corrupted so that it violates any of the following constraints:

2. The typeof Evaluation Returns 'function'

Lodash explicitly rejects any value where typeof value === 'function', even if that value possesses a valid .length property.

3. The Reference Is null or Fails Object Classification

The isObjectLike check requires the value to be both non-null and typed as an object: