source: trip-planner-front/node_modules/lodash/has.js@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 757 bytes
Line 
1var baseHas = require('./_baseHas'),
2 hasPath = require('./_hasPath');
3
4/**
5 * Checks if `path` is a direct property of `object`.
6 *
7 * @static
8 * @since 0.1.0
9 * @memberOf _
10 * @category Object
11 * @param {Object} object The object to query.
12 * @param {Array|string} path The path to check.
13 * @returns {boolean} Returns `true` if `path` exists, else `false`.
14 * @example
15 *
16 * var object = { 'a': { 'b': 2 } };
17 * var other = _.create({ 'a': _.create({ 'b': 2 }) });
18 *
19 * _.has(object, 'a');
20 * // => true
21 *
22 * _.has(object, 'a.b');
23 * // => true
24 *
25 * _.has(object, ['a', 'b']);
26 * // => true
27 *
28 * _.has(other, 'a');
29 * // => false
30 */
31function has(object, path) {
32 return object != null && hasPath(object, path, baseHas);
33}
34
35module.exports = has;
Note: See TracBrowser for help on using the repository browser.