Ensure _.omit works with symbols.

This commit is contained in:
John-David Dalton
2016-03-04 02:03:23 -08:00
parent 1b8071d2c4
commit 0589dd6909
2 changed files with 82 additions and 12 deletions

View File

@@ -2303,7 +2303,7 @@
*
* @private
* @param {*} value The value to inspect.
* @returns {Array} Returns the array-like object.
* @returns {Array|Object} Returns the cast array-like object.
*/
function baseCastArrayLikeObject(value) {
return isArrayLikeObject(value) ? value : [];
@@ -2314,12 +2314,23 @@
*
* @private
* @param {*} value The value to inspect.
* @returns {Array} Returns the array-like object.
* @returns {Function} Returns cast function.
*/
function baseCastFunction(value) {
return typeof value == 'function' ? value : identity;
}
/**
* Casts `value` to a string if it's not a string or symbol.
*
* @private
* @param {*} value The value to inspect.
* @returns {string|symbol} Returns the cast key.
*/
function baseCastKey(key) {
return (typeof key == 'string' || isSymbol(key)) ? key : (key + '');
}
/**
* Casts `value` to a path array if it's not one.
*
@@ -12042,8 +12053,12 @@
if (object == null) {
return {};
}
props = arrayMap(baseFlatten(props, 1), String);
return basePick(object, baseDifference(keysIn(object), props));
var allProps = keysIn(object);
if (!isArray(object)) {
arrayPush(allProps, getSymbolsIn(object));
}
props = arrayMap(baseFlatten(props, 1), baseCastKey);
return basePick(object, baseDifference(allProps, props));
});
/**
@@ -14494,7 +14509,7 @@
* // => false
*/
function toPath(value) {
return isArray(value) ? arrayMap(value, String) : stringToPath(value);
return isArray(value) ? arrayMap(value, baseCastKey) : stringToPath(value);
}
/**