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

Double negation support #2343

Closed
nazar-pc opened this issue Aug 22, 2015 · 1 comment
Closed

Double negation support #2343

nazar-pc opened this issue Aug 22, 2015 · 1 comment

Comments

@nazar-pc
Copy link
Contributor

It is sometimes convenient to use double negation.
For instance, sometimes you have numeric property and you want other element to have active property if only number is non-zero, in this case double negation is useful in order to pass boolean value instead of numeric:

<my-element attr$="[[!!numeric_prop]]"></my-element>

It is much nicer to have just attr instead of attr="5".
Probably, related to #2182, but I'm not sure.

@dfreedm
Copy link
Member

dfreedm commented Nov 3, 2015

We're not very interested in expanding the vocabulary of expressions right now.
You can always make a computed function that applies a boolean pass over the input:

<my-element attr$="[[bool(numeric_prop)]]"></my-element>
  bool: function(prop) {
    return !!prop;
  }

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

No branches or pull requests

2 participants