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.

29 lines
854 B

4 years ago
  1. var baseIteratee = require('./_baseIteratee'),
  2. negate = require('./negate'),
  3. pickBy = require('./pickBy');
  4. /**
  5. * The opposite of `_.pickBy`; this method creates an object composed of
  6. * the own and inherited enumerable string keyed properties of `object` that
  7. * `predicate` doesn't return truthy for. The predicate is invoked with two
  8. * arguments: (value, key).
  9. *
  10. * @static
  11. * @memberOf _
  12. * @since 4.0.0
  13. * @category Object
  14. * @param {Object} object The source object.
  15. * @param {Function} [predicate=_.identity] The function invoked per property.
  16. * @returns {Object} Returns the new object.
  17. * @example
  18. *
  19. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  20. *
  21. * _.omitBy(object, _.isNumber);
  22. * // => { 'b': '2' }
  23. */
  24. function omitBy(object, predicate) {
  25. return pickBy(object, negate(baseIteratee(predicate)));
  26. }
  27. module.exports = omitBy;