mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 03:47:50 +00:00
Add _.isEmpty test for prototype objects.
This commit is contained in:
@@ -11434,7 +11434,7 @@
|
|||||||
return !value.size;
|
return !value.size;
|
||||||
}
|
}
|
||||||
if (isPrototype(value)) {
|
if (isPrototype(value)) {
|
||||||
return !nativeKeys(value).length;
|
return !baseKeys(value).length;
|
||||||
}
|
}
|
||||||
for (var key in value) {
|
for (var key in value) {
|
||||||
if (hasOwnProperty.call(value, key)) {
|
if (hasOwnProperty.call(value, key)) {
|
||||||
|
|||||||
12
test/test.js
12
test/test.js
@@ -9366,6 +9366,18 @@
|
|||||||
assert.strictEqual(_.isEmpty(args), false);
|
assert.strictEqual(_.isEmpty(args), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('should work with prototytpe objects', function(assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
|
||||||
|
function Foo() {}
|
||||||
|
Foo.prototype = { 'constructor': Foo };
|
||||||
|
|
||||||
|
assert.strictEqual(_.isEmpty(Foo.prototype), true);
|
||||||
|
|
||||||
|
Foo.prototype.a = 1;
|
||||||
|
assert.strictEqual(_.isEmpty(Foo.prototype), false);
|
||||||
|
});
|
||||||
|
|
||||||
QUnit.test('should work with jQuery/MooTools DOM query collections', function(assert) {
|
QUnit.test('should work with jQuery/MooTools DOM query collections', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user