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

and returns non-boolean value rather than converting it (which breaks default value logic) #202

Open
emattias opened this issue Oct 10, 2023 · 0 comments

Comments

@emattias
Copy link

emattias commented Oct 10, 2023

The and helper returns the value as it is if its falsy (rather than converting it to a boolean first) here: https://github.com/jmurphyau/ember-truth-helpers/blob/master/packages/ember-truth-helpers/src/helpers/and.ts#L33

This results in some unexpected behavior, see twiddle

CleanShot 2023-10-10 at 15 15 31@2x

Suggestion

Can we change that line to:

return truthConvert(params[i]);

or

return !!params[i];

So that and returns false rather than undefined when it gets undefined. That would result in a more expected behavior IMO.

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

1 participant