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
Add arbitrary expression parsing in curly braces … #46
Conversation
I found myself wanting to push the limits of what `template` can do, but I didn't want to pull in a larger templating library, so I figured we could just allow the template function to handle any expression inside it.
Hi @brandonpittman I appreciate your PR, but I will have to ask you to add some tests, because as much as I see, there should be a change in |
Few more things:
|
I’ll work on that today. Thanks. |
@selfrefactor I changed the I also changed the test because it shouldn't spit out the template string anymore. It's going to evaluate everything in the brackets, which should actually throw a reference error. |
I will check it later today. Thank you again. |
I copied your version of R.template and I ran it against the current Rambdax spec. This test:
you know that fails. because in your tests you expect to throw. We would introduce a breaking change, this even forcing to major bump. Tests are contracts, and I think this contract of Maybe you should change the method so it passes the failing test. |
@selfrefactor Okay, we now just pass back the unprocessed input in the event of a ReferenceError. Existing specs pass and I added a new one for arbitrary JS expressions. |
@brandonpittman - that sounds good to me. As you may have understand, my main interest is not the code itself rather than what happens with the tests. I will wait for you to notify me once you are ready with the tests. |
Not sure what you mean. The latest commit makes all your tests pass and passes a new test I wrote to cover bare expressions. |
I will release a version this Sunday. Thank you for your collaboration. |
Thank you! |
Just released |
@selfrefactor Still showing up at 3.5 on NPM. |
I realized that just now, and finally the release is made. |
I found myself wanting to push the limits of what
template
can do, but I didn't want to pull in a larger templating library, so I figured we could just allow the template function to handle any expression inside it.