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.

has.js 757B

1234567891011121314151617181920212223242526272829303132333435
  1. var baseHas = require('./_baseHas'),
  2. hasPath = require('./_hasPath');
  3. /**
  4. * Checks if `path` is a direct property of `object`.
  5. *
  6. * @static
  7. * @since 0.1.0
  8. * @memberOf _
  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 = { 'a': { 'b': 2 } };
  16. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  17. *
  18. * _.has(object, 'a');
  19. * // => true
  20. *
  21. * _.has(object, 'a.b');
  22. * // => true
  23. *
  24. * _.has(object, ['a', 'b']);
  25. * // => true
  26. *
  27. * _.has(other, 'a');
  28. * // => false
  29. */
  30. function has(object, path) {
  31. return object != null && hasPath(object, path, baseHas);
  32. }
  33. module.exports = has;