@putout/printer 1.48.0 → 1.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ 2023.04.14, v1.49.0
2
+
3
+ fix:
4
+ - b056bb5 @putout/printer: newline in ObjectExpression inside IfStatement
5
+
1
6
  2023.04.14, v1.48.0
2
7
 
3
8
  feature:
@@ -1,11 +1,20 @@
1
1
  'use strict';
2
2
 
3
3
  const {isCoupleLines} = require('../is');
4
- const {isFunction} = require('@babel/types');
4
+
5
+ const {
6
+ isFunction,
7
+ isIfStatement,
8
+ isStatement,
9
+ } = require('@babel/types');
10
+
5
11
  const isBodyOfArrow = (path) => path.parentPath.node.body === path.node;
6
12
  const isLogical = (path) => path.get('argument').isLogicalExpression();
7
13
  const isValue = (path) => path.get('properties.0.value').node;
8
- const isIf = (path) => path.parentPath.parentPath.isIfStatement();
14
+ const isIfOrStatement = (a) => isIfStatement(a) || isStatement(a);
15
+ const isIf = (path) => isIfStatement(path.find(
16
+ isIfOrStatement,
17
+ ));
9
18
  const isParentExpression = (path) => path.parentPath.isExpressionStatement();
10
19
 
11
20
  const isForOf = (path) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "1.48.0",
3
+ "version": "1.49.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Easiest possible opinionated Babel AST printer made with ❤️ to use in 🐊Putout",