mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 09:27:49 +00:00
Bump to v3.6.0.
This commit is contained in:
@@ -4,7 +4,8 @@ var arrayMap = require('../internal/arrayMap'),
|
||||
bindCallback = require('../internal/bindCallback'),
|
||||
keysIn = require('./keysIn'),
|
||||
pickByArray = require('../internal/pickByArray'),
|
||||
pickByCallback = require('../internal/pickByCallback');
|
||||
pickByCallback = require('../internal/pickByCallback'),
|
||||
restParam = require('../function/restParam');
|
||||
|
||||
/**
|
||||
* The opposite of `_.pick`; this method creates an object composed of the
|
||||
@@ -12,7 +13,7 @@ var arrayMap = require('../internal/arrayMap'),
|
||||
* Property names may be specified as individual arguments or as arrays of
|
||||
* property names. If `predicate` is provided it is invoked for each property
|
||||
* of `object` omitting the properties `predicate` returns truthy for. The
|
||||
* predicate is bound to `thisArg` and invoked with three arguments;
|
||||
* predicate is bound to `thisArg` and invoked with three arguments:
|
||||
* (value, key, object).
|
||||
*
|
||||
* @static
|
||||
@@ -34,18 +35,18 @@ var arrayMap = require('../internal/arrayMap'),
|
||||
* _.omit(object, _.isNumber);
|
||||
* // => { 'user': 'fred' }
|
||||
*/
|
||||
function omit(object, predicate, thisArg) {
|
||||
var omit = restParam(function(object, props) {
|
||||
if (object == null) {
|
||||
return {};
|
||||
}
|
||||
if (typeof predicate != 'function') {
|
||||
var props = arrayMap(baseFlatten(arguments, false, false, 1), String);
|
||||
if (typeof props[0] != 'function') {
|
||||
var props = arrayMap(baseFlatten(props), String);
|
||||
return pickByArray(object, baseDifference(keysIn(object), props));
|
||||
}
|
||||
predicate = bindCallback(predicate, thisArg, 3);
|
||||
var predicate = bindCallback(props[0], props[1], 3);
|
||||
return pickByCallback(object, function(value, key, object) {
|
||||
return !predicate(value, key, object);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = omit;
|
||||
|
||||
Reference in New Issue
Block a user