mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-13 12:27:49 +00:00
Add getAllKeysIn helper.
This commit is contained in:
28
lodash.js
28
lodash.js
@@ -3317,11 +3317,8 @@
|
|||||||
* @returns {Object} Returns the new object.
|
* @returns {Object} Returns the new object.
|
||||||
*/
|
*/
|
||||||
function basePickBy(object, predicate) {
|
function basePickBy(object, predicate) {
|
||||||
var props = keysIn(object);
|
|
||||||
if (!isArray(object)) {
|
|
||||||
arrayPush(props, getSymbolsIn(object));
|
|
||||||
}
|
|
||||||
var index = -1,
|
var index = -1,
|
||||||
|
props = getAllKeysIn(object),
|
||||||
length = props.length,
|
length = props.length,
|
||||||
result = {};
|
result = {};
|
||||||
|
|
||||||
@@ -4952,6 +4949,21 @@
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an array of the own and inherited enumerable property names and
|
||||||
|
* symbols of `object`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object} object The object to query.
|
||||||
|
* @returns {Array} Returns the array of property names and symbols.
|
||||||
|
*/
|
||||||
|
function getAllKeysIn(object) {
|
||||||
|
var result = keysIn(object);
|
||||||
|
return isArray(object)
|
||||||
|
? result
|
||||||
|
: arrayPush(result, getSymbolsIn(object));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets metadata for `func`.
|
* Gets metadata for `func`.
|
||||||
*
|
*
|
||||||
@@ -12049,7 +12061,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Object
|
* @category Object
|
||||||
* @param {Object} object The source object.
|
* @param {Object} object The source object.
|
||||||
* @param {...(string|string[])} [props] The property names to omit, specified
|
* @param {...(string|string[])} [props] The property identifiers to omit, specified
|
||||||
* individually or in arrays.
|
* individually or in arrays.
|
||||||
* @returns {Object} Returns the new object.
|
* @returns {Object} Returns the new object.
|
||||||
* @example
|
* @example
|
||||||
@@ -12063,12 +12075,8 @@
|
|||||||
if (object == null) {
|
if (object == null) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
var allProps = keysIn(object);
|
|
||||||
if (!isArray(object)) {
|
|
||||||
arrayPush(allProps, getSymbolsIn(object));
|
|
||||||
}
|
|
||||||
props = arrayMap(baseFlatten(props, 1), baseCastKey);
|
props = arrayMap(baseFlatten(props, 1), baseCastKey);
|
||||||
return basePick(object, baseDifference(allProps, props));
|
return basePick(object, baseDifference(getAllKeysIn(object), props));
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user