mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 01:47:48 +00:00
Bump to v4.0.0.
This commit is contained in:
29
omitBy.js
Normal file
29
omitBy.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import baseIteratee from './internal/baseIteratee';
|
||||
import basePickBy from './internal/basePickBy';
|
||||
|
||||
/**
|
||||
* The opposite of `_.pickBy`; this method creates an object composed of the
|
||||
* own and inherited enumerable properties of `object` that `predicate`
|
||||
* doesn't return truthy for.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Object
|
||||
* @param {Object} object The source object.
|
||||
* @param {Function|Object|string} [predicate=_.identity] The function invoked per property.
|
||||
* @returns {Object} Returns the new object.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
||||
*
|
||||
* _.omitBy(object, _.isNumber);
|
||||
* // => { 'b': '2' }
|
||||
*/
|
||||
function omitBy(object, predicate) {
|
||||
predicate = baseIteratee(predicate);
|
||||
return basePickBy(object, function(value) {
|
||||
return !predicate(value);
|
||||
});
|
||||
}
|
||||
|
||||
export default omitBy;
|
||||
Reference in New Issue
Block a user