* Checks if `path` is a direct property. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` is a direct property, else `false`.
(object, path)
| 10897 | * // => true |
| 10898 | */ |
| 10899 | function has(object, path) { |
| 10900 | if (object == null) { |
| 10901 | return false; |
| 10902 | } |
| 10903 | var result = hasOwnProperty.call(object, path); |
| 10904 | if (!result && !isKey(path)) { |
| 10905 | path = toPath(path); |
| 10906 | object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); |
| 10907 | path = last(path); |
| 10908 | result = object != null && hasOwnProperty.call(object, path); |
| 10909 | } |
| 10910 | return result; |
| 10911 | } |
| 10912 | |
| 10913 | /** |
| 10914 | * Creates an object composed of the inverted keys and values of `object`. |
no test coverage detected