UNPKG

531 BJavaScriptView Raw
1import get from './get.js';
2
3/**
4 * Determines if a nested value is defined
5 *
6 * @example
7 * ``` javascript
8 * import { has } from 'object-agent';
9 *
10 * const thing = {
11 * a: [{
12 * b: 'c'
13 * }, {
14 * b: 'd'
15 * }]
16 * };
17 *
18 * has(thing, 'a.1.b');
19 * // => true
20 * ```
21 *
22 * @function has
23 * @category Interaction
24 *
25 * @arg {Object} object
26 * @arg {String} path - Dot delimited string
27 *
28 * @returns {*}
29 */
30export default (object, path) => get(object, path) !== undefined;
31
\No newline at end of file