Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isEmpty should check for empty objects #230

Closed
wants to merge 1 commit into from
Closed

isEmpty should check for empty objects #230

wants to merge 1 commit into from

Conversation

m0rk
Copy link

@m0rk m0rk commented Apr 27, 2012

I understand this part of the documentation

when used with an empty ({}) context, will result in:

as if you have an empty object, the value will be considered "falsy".
Handlebars.Utils.isEmpty(context) has no check for empty objects, so did I just understand the documentation wrong?

Anyhow, I would like to have a check on empty objects, thus the pull request. :)

@zedd45
Copy link

zedd45 commented Jun 29, 2012

+1. I'm going to integrate this fix into my local dev. Thanks Mark!

@c089
Copy link

c089 commented Mar 21, 2013

so did I just understand the documentation wrong?

Yes I think you did. But the documentation is misleading here, I had to read it several times as well: It says if you render that template example with an empty context ({}), then "author" is undefined and thus the block is not rendered.

However, I still think that empty object should be falsy!

@kpdecker
Copy link
Collaborator

kpdecker commented Feb 9, 2014

This is not something that we can change at this point. I've updated the documentation to make the author portion clearer. We're also going to add formal documentation on this method so downstream code can monkey patch with the behavior in the PR if they so choose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants