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.

conformsTo.js 954B

1234567891011121314151617181920212223242526272829303132
  1. var baseConformsTo = require('./_baseConformsTo'),
  2. keys = require('./keys');
  3. /**
  4. * Checks if `object` conforms to `source` by invoking the predicate
  5. * properties of `source` with the corresponding property values of `object`.
  6. *
  7. * **Note:** This method is equivalent to `_.conforms` when `source` is
  8. * partially applied.
  9. *
  10. * @static
  11. * @memberOf _
  12. * @since 4.14.0
  13. * @category Lang
  14. * @param {Object} object The object to inspect.
  15. * @param {Object} source The object of property predicates to conform to.
  16. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  17. * @example
  18. *
  19. * var object = { 'a': 1, 'b': 2 };
  20. *
  21. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  22. * // => true
  23. *
  24. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  25. * // => false
  26. */
  27. function conformsTo(object, source) {
  28. return source == null || baseConformsTo(object, source, keys(source));
  29. }
  30. module.exports = conformsTo;