_.isEmpty() behavior on date objects. #445

Closed
fragnemesis opened this Issue Jan 26, 2012 · 2 comments

Projects

None yet

3 participants

@fragnemesis

Current implementation of _.isEmpty() always returns true for date objects. Should this be the case?

for example, _.isEmpty(new Date("2/2/2012")) returns true.

@jashkenas
Owner

isEmpty is a function that works on Objects and Arrays -- behavior on other types of natives is undefined.

@jashkenas jashkenas closed this Jan 26, 2012
@jdalton

@jashkenas

isEmpty is a function that works on Objects and Arrays -- behavior on other types of natives is undefined.

Based on the code _.isEmpty() also works on strings. The documentation should probably be updated.

@fragnemesis

The result of new Date('2/2/2012') is an object ;D
It just doesn't have any enumerable own properties which is why _.isEmpty(...) correctly returns true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment