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

Add support null-coalescing operator ?? #575

Merged
merged 2 commits into from
Jul 9, 2018
Merged

Add support null-coalescing operator ?? #575

merged 2 commits into from
Jul 9, 2018

Conversation

toptalo
Copy link
Contributor

@toptalo toptalo commented Jul 9, 2018

Address issue #319

Copy link
Collaborator

@willrowe willrowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just some formatting.

Copy link
Collaborator

@willrowe willrowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just some formatting.


it("should support the null-coalescing operator for false conditions", function() {
debugger;
var test_template = twig({data: '{{ a ?? b }}'})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the commas to the same line at the end.

@@ -55,6 +55,27 @@ describe("Twig.js Expression Operators ->", function() {
});
});

describe("?? ->", function() {
it("should support the null-coalescing operator for true conditions", function() {
var test_template = twig({data: '{{ a ?? b }}'})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the commas to the same line at the end.

, output_t = test_template.render({a: undefined, b: "two"})
, output_f = test_template.render({a: null, b: "two"});

output_t.should.equal( "two" );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove spaces around strings.

, output_t = test_template.render({a: "one", b: "two"})
, output_f = test_template.render({a: false, b: "two"});

output_t.should.equal( "one" );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove spaces around strings.

@dave-irvine
Copy link
Contributor

@willrowe Want to implement Prettier and run a pass over the entire codebase + tests to standardise?

@willrowe
Copy link
Collaborator

willrowe commented Jul 9, 2018

@dave-irvine that would be nice, I'll add it to my list to look into.

@dave-irvine dave-irvine merged commit d4798de into twigjs:master Jul 9, 2018
@toptalo
Copy link
Contributor Author

toptalo commented Jul 9, 2018

Thanks!

@toptalo toptalo deleted the issue-319 branch July 9, 2018 14:56
willrowe pushed a commit to willrowe/twig.js that referenced this pull request May 11, 2019
* Add support null-coalescing operator `??`

Address issue twigjs#319

* Add some formatting
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.

3 participants