Revert allowing _.omit and _.pick to work as a callback for _.map when combined with _.partialRight to be solved with _.partial placeholders in v3.

This commit is contained in:
John-David Dalton
2014-02-10 00:32:10 -08:00
parent de3d9dca72
commit dae0b25717
8 changed files with 71 additions and 157 deletions

View File

@@ -6432,18 +6432,10 @@
* // => { 'name': 'fred' }
*/
function omit(object, callback, thisArg) {
var result = {},
type = typeof callback;
var result = {};
if (type != 'function') {
// enables use as a callback for functions like `_.map`
// when combined with `_.partialRight`
var args = arguments;
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === object) {
args = slice(args);
splice.call(args, 1, 2);
}
var omitProps = baseFlatten(args, true, false, 1),
if (typeof callback != 'function') {
var omitProps = baseFlatten(arguments, true, false, 1),
length = omitProps.length;
while (length--) {
@@ -6528,19 +6520,11 @@
* // => { 'name': 'fred' }
*/
function pick(object, callback, thisArg) {
var result = {},
type = typeof callback;
var result = {};
if (type != 'function') {
// enables use as a callback for functions like `_.map`
// when combined with `_.partialRight`
var args = arguments;
if ((type == 'number' || type == 'string') && thisArg && thisArg[callback] === object) {
args = slice(args);
splice.call(args, 1, 2);
}
if (typeof callback != 'function') {
var index = -1,
props = baseFlatten(args, true, false, 1),
props = baseFlatten(arguments, true, false, 1),
length = isObject(object) ? props.length : 0;
while (++index < length) {