* Checks if `path` exists on `object`. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @param {Function} hasFunc The function to check properties. * @returns {boolean} Returns `true` if
(object, path, hasFunc)
| 16748 | * @returns {boolean} Returns `true` if `path` exists, else `false`. |
| 16749 | */ |
| 16750 | function hasPath(object, path, hasFunc) { |
| 16751 | path = castPath(path, object); |
| 16752 | |
| 16753 | var index = -1, |
| 16754 | length = path.length, |
| 16755 | result = false; |
| 16756 | |
| 16757 | while (++index < length) { |
| 16758 | var key = toKey(path[index]); |
| 16759 | if (!(result = object != null && hasFunc(object, key))) { |
| 16760 | break; |
| 16761 | } |
| 16762 | object = object[key]; |
| 16763 | } |
| 16764 | if (result || ++index != length) { |
| 16765 | return result; |
| 16766 | } |
| 16767 | length = object == null ? 0 : object.length; |
| 16768 | return !!length && isLength(length) && isIndex(key, length) && |
| 16769 | (isArray(object) || isArguments(object)); |
| 16770 | } |
| 16771 | |
| 16772 | /** |
| 16773 | * Initializes an array clone. |