mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
Remove explicit Object coercion in _.keysIn.
This commit is contained in:
@@ -3877,7 +3877,7 @@
|
|||||||
* @returns {Array} Returns the initialized array of property names.
|
* @returns {Array} Returns the initialized array of property names.
|
||||||
*/
|
*/
|
||||||
function initKeys(object) {
|
function initKeys(object) {
|
||||||
var length = object.length;
|
var length = object ? object.length : 0;
|
||||||
length = (length && isLength(length) &&
|
length = (length && isLength(length) &&
|
||||||
(isArray(object) || isArguments(object) || isString(object)) && length) || 0;
|
(isArray(object) || isArguments(object) || isString(object)) && length) || 0;
|
||||||
|
|
||||||
@@ -9171,8 +9171,6 @@
|
|||||||
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
||||||
*/
|
*/
|
||||||
function keysIn(object) {
|
function keysIn(object) {
|
||||||
object = Object(object);
|
|
||||||
|
|
||||||
var index = -1,
|
var index = -1,
|
||||||
isProto = isPrototype(object),
|
isProto = isPrototype(object),
|
||||||
props = baseKeysIn(object),
|
props = baseKeysIn(object),
|
||||||
|
|||||||
@@ -8773,10 +8773,10 @@
|
|||||||
deepEqual(func(array).sort(), ['0', '1', '2']);
|
deepEqual(func(array).sort(), ['0', '1', '2']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should coerce nullish values to objects', 2, function() {
|
test('`_.' + methodName + '` should not coerce nullish values to objects', 2, function() {
|
||||||
objectProto.a = 1;
|
objectProto.a = 1;
|
||||||
_.each([null, undefined], function(value) {
|
_.each([null, undefined], function(value) {
|
||||||
deepEqual(func(value), isKeys ? [] : ['a']);
|
deepEqual(func(value), []);
|
||||||
});
|
});
|
||||||
delete objectProto.a;
|
delete objectProto.a;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user