1 var baseToPath = require('./_baseToPath'),
2 isArguments = require('./isArguments'),
3 isArray = require('./isArray'),
4 isIndex = require('./_isIndex'),
5 isKey = require('./_isKey'),
6 isLength = require('./isLength'),
7 isString = require('./isString'),
8 last = require('./last'),
9 parent = require('./_parent');
12 * Checks if `path` exists on `object`.
15 * @param {Object} object The object to query.
16 * @param {Array|string} path The path to check.
17 * @param {Function} hasFunc The function to check properties.
18 * @returns {boolean} Returns `true` if `path` exists, else `false`.
20 function hasPath(object, path, hasFunc) {
24 var result = hasFunc(object, path);
25 if (!result && !isKey(path)) {
26 path = baseToPath(path);
27 object = parent(object, path);
30 result = hasFunc(object, path);
33 var length = object ? object.length : undefined;
35 !!length && isLength(length) && isIndex(path, length) &&
36 (isArray(object) || isString(object) || isArguments(object))
40 module.exports = hasPath;