-
Notifications
You must be signed in to change notification settings - Fork 275
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
Conversation
Address issue #319
There was a problem hiding this 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.
There was a problem hiding this 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.
test/test.expressions.operators.js
Outdated
|
||
it("should support the null-coalescing operator for false conditions", function() { | ||
debugger; | ||
var test_template = twig({data: '{{ a ?? b }}'}) |
There was a problem hiding this comment.
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.
test/test.expressions.operators.js
Outdated
@@ -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 }}'}) |
There was a problem hiding this comment.
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.
test/test.expressions.operators.js
Outdated
, output_t = test_template.render({a: undefined, b: "two"}) | ||
, output_f = test_template.render({a: null, b: "two"}); | ||
|
||
output_t.should.equal( "two" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove spaces around strings.
test/test.expressions.operators.js
Outdated
, output_t = test_template.render({a: "one", b: "two"}) | ||
, output_f = test_template.render({a: false, b: "two"}); | ||
|
||
output_t.should.equal( "one" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove spaces around strings.
@willrowe Want to implement Prettier and run a pass over the entire codebase + tests to standardise? |
@dave-irvine that would be nice, I'll add it to my list to look into. |
Thanks! |
* Add support null-coalescing operator `??` Address issue twigjs#319 * Add some formatting
Address issue #319