vue-app-sdk
Version:
26 lines (25 loc) • 781 B
JavaScript
import castPath from "./_castPath.js";
import isArguments from "./isArguments.js";
import isArray from "./isArray.js";
import isIndex from "./_isIndex.js";
import isLength from "./isLength.js";
import toKey from "./_toKey.js";
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
};