8000 Fix 'starts with' and 'ends with' expressions by ilkkave · Pull Request #661 · twigjs/twig.js · GitHub
[go: up one dir, main page]

Skip to content

Fix 'starts with' and 'ends with' expressions #661

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

8000
Merged
merged 1 commit into from
Oct 16, 2019

Conversation

ilkkave
Copy link
Contributor
@ilkkave ilkkave commented Sep 23, 2019

Fixes #660

Makes starts with and ends with expressions to not throw an error with non-string values.

Changes proposed in this pull request:

  • Add a check for starts with and ends with expressions to check if it’s tested against a string.
  • Add a test case where using starts with and ends with with an undefined variable.

@RobLoach
Copy link
Collaborator

Thanks, this will help clean up input exceptions...

Should this also work with numbers or values? Outside of just strings?

@ilkkave
Copy link
Contributor Author
ilkkave commented Sep 25, 2019

Should this also work with numbers or values? Outside of just strings?

I think it should only work with strings, but I can take a look how it works in Twig.

@RobLoach RobLoach merged commit a00787d into twigjs:master Oct 16, 2019
@RobLoach
Copy link
Collaborator

This is a good change in the mean time. For array support, that should likely be a new PR. Thanks!

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

Successfully merging this pull request may close these issues.

"starts with" and "ends with" expressions result in error with non-string values
2 participants
0