marko-js-archive / marko-widgets

[LEGACY] Module to support binding of behavior to rendered UI components rendered on the server or client
http://v3.markojs.com/docs/marko-widgets/
MIT License
141 stars 40 forks source link

notEmpty not working for Boolean flags? #64

Closed anandshenoy14 closed 9 years ago

anandshenoy14 commented 9 years ago

@patrick-steele-idem

I am not sure why this is specifically not working for me but notEmpty(data.something.booleanFlag) is not working and returning false all the time.

<if test="notEmpty(out.global.isMobile)">
</if>

isMobile is the boolean flag

anandshenoy14 commented 9 years ago

Answer:

we will never have to check if a boolean is not empty as even if it is empty usage will return false

patrick-steele-idem commented 9 years ago

For reference, here is the implementation of the notEmpty() helper: https://github.com/marko-js/marko/blob/36ba6763fd3a1e0b1ff978c732d7a6c15a3dc621/runtime/helpers.js#L20-L30

Docs need to be improved and better describe the builtin empty() and notEmpty() helpers. We have an open Github issue for this: https://github.com/marko-js/marko/issues/15