Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hasIn.js 753B

12345678910111213141516171819202122232425262728293031323334
  1. var baseHasIn = require('./_baseHasIn'),
  2. hasPath = require('./_hasPath');
  3. /**
  4. * Checks if `path` is a direct or inherited property of `object`.
  5. *
  6. * @static
  7. * @memberOf _
  8. * @since 4.0.0
  9. * @category Object
  10. * @param {Object} object The object to query.
  11. * @param {Array|string} path The path to check.
  12. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  13. * @example
  14. *
  15. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  16. *
  17. * _.hasIn(object, 'a');
  18. * // => true
  19. *
  20. * _.hasIn(object, 'a.b');
  21. * // => true
  22. *
  23. * _.hasIn(object, ['a', 'b']);
  24. * // => true
  25. *
  26. * _.hasIn(object, 'b');
  27. * // => false
  28. */
  29. function hasIn(object, path) {
  30. return object != null && hasPath(object, path, baseHasIn);
  31. }
  32. module.exports = hasIn;