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

default filter is not working with an empty string #122

Closed
IrakliJani opened this issue Apr 26, 2019 · 0 comments
Closed

default filter is not working with an empty string #122

IrakliJani opened this issue Apr 26, 2019 · 0 comments
Labels

Comments

@IrakliJani
Copy link

IrakliJani commented Apr 26, 2019

default filter is not working with an empty string.
For example: https://jsfiddle.net/q3vL9dkn/

{{ null | default: "default on null"}}
=> "default on null"

{{ "" | default: "default on empty string"}}
=> ""

This works well with Shopify's Liquid (check out last example): https://shopify.github.io/liquid/filters/default/

I have read source code for default filter and Differences With shopify/liquid (about truthy values) but I think we should make an exception for default filter and add an extra check for an empty string.

I can make a PR for it If you think it's a good idea.
Thanks!

@IrakliJani IrakliJani changed the title Default filter is not working with an empty string default filter is not working with an empty string Apr 26, 2019
@harttle harttle added the bug label Apr 26, 2019
harttle pushed a commit that referenced this issue Apr 26, 2019
## [8.2.1](v8.2.0...v8.2.1) (2019-04-26)

### Bug Fixes

* `default` filter is not working with an empty string, [#122](#122) ([6075c0a](6075c0a))
@harttle harttle closed this as completed Apr 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants