import castPath from "./_castPath.mjs";
import isArguments from "./isArguments.mjs";
import isArray from "./isArray.mjs";
import isIndex from "./_isIndex.mjs";
import isLength from "./isLength.mjs";
import toKey from "./_toKey.mjs";
function hasPath(object, path, hasFunc) {
  path = castPath(path, object);
  var index = -1, length = path.length, result = false;
  while (++index < length) {
    var key = toKey(path[index]);
    if (!(result = object != null && hasFunc(object, key))) {
      break;
    }
    object = object[key];
  }
  if (result || ++index != length) {
    return result;
  }
  length = object == null ? 0 : object.length;
  return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
}
export {
  hasPath as default
};
