mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
Bump to v3.6.0.
This commit is contained in:
@@ -5,6 +5,7 @@ import bindCallback from '../internal/bindCallback';
|
||||
import keysIn from './keysIn';
|
||||
import pickByArray from '../internal/pickByArray';
|
||||
import pickByCallback from '../internal/pickByCallback';
|
||||
import restParam from '../function/restParam';
|
||||
|
||||
/**
|
||||
* The opposite of `_.pick`; this method creates an object composed of the
|
||||
@@ -12,7 +13,7 @@ import pickByCallback from '../internal/pickByCallback';
|
||||
* 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 @@ import pickByCallback from '../internal/pickByCallback';
|
||||
* _.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);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export default omit;
|
||||
|
||||
Reference in New Issue
Block a user