vue-app-sdk
Version:
26 lines (25 loc) • 989 B
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const _castPath = require("./_castPath.cjs");
const isArguments = require("./isArguments.cjs");
const isArray = require("./isArray.cjs");
const _isIndex = require("./_isIndex.cjs");
const isLength = require("./isLength.cjs");
const _toKey = require("./_toKey.cjs");
function hasPath(object, path, hasFunc) {
path = _castPath.default(path, object);
var index = -1, length = path.length, result = false;
while (++index < length) {
var key = _toKey.default(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.default(length) && _isIndex.default(key, length) && (isArray.default(object) || isArguments.default(object));
}
exports.default = hasPath;