forked from notandy/ympd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4d9b27c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, that doesn't work.
obj.data.length is undefined, you have to use Object.keys(obj.data).length
4d9b27c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I figured the same after Issue notandy#170, hence the new pull request.
I'm wondering though, which solution would be faster? I suppose .keys() would loop over Object to gather all keys, before .length() would loop over the resulting array to count the number of entries, thus - depending on the result - leading to a total of two or three loops. The proposed way, on the other hand, loops only once, but changes the DOM even if it's not necessary after all.
4d9b27c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.