code-red
Advanced tools
Comparing version 0.1.3 to 0.1.4
# code-red changelog | ||
## 0.1.4 | ||
* Fix rendering of nullish coalescing operator alongside other logical operators ([#52](https://github.com/Rich-Harris/code-red/issues/52)) | ||
## 0.1.3 | ||
@@ -4,0 +8,0 @@ |
@@ -150,2 +150,13 @@ (function (global, factory) { | ||
function needs_parens(node, parent, is_right) { | ||
// special case where logical expressions and coalesce expressions cannot be mixed, | ||
// either of them need to be wrapped with parentheses | ||
if ( | ||
node.type === 'LogicalExpression' && | ||
parent.type === 'LogicalExpression' && | ||
((parent.operator === '??' && node.operator !== '??') || | ||
(parent.operator !== '??' && node.operator === '??')) | ||
) { | ||
return true; | ||
} | ||
const precedence = EXPRESSIONS_PRECEDENCE[node.type]; | ||
@@ -152,0 +163,0 @@ const parent_precedence = EXPRESSIONS_PRECEDENCE[parent.type]; |
{ | ||
"name": "code-red", | ||
"description": "code-red", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"repository": "Rich-Harris/code-red", | ||
@@ -6,0 +6,0 @@ "main": "dist/code-red.js", |
Sorry, the diff of this file is not supported yet
86971
2942