@putout/printer 13.4.0 → 13.4.1

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
+ 2025.03.13, v13.4.1
2
+
3
+ feature:
4
+ - 982f309 @putout/printer: is: simplify
5
+
1
6
  2025.03.13, v13.4.0
2
7
 
3
8
  feature:
@@ -78,8 +78,20 @@ function isStringAndIdentifier([a, b]) {
78
78
  return isStringLiteral(a) && isIdentifier(b);
79
79
  }
80
80
 
81
+ const checkObject = (elements) => {
82
+ let a = elements.at(-1);
83
+
84
+ if (!isObjectExpression(a))
85
+ a = elements.at(-2);
86
+
87
+ if (!isObjectExpression(a))
88
+ return false;
89
+
90
+ return a.node.properties.length;
91
+ };
92
+
81
93
  module.exports.isSimpleAndNotEmptyObject = (elements) => {
82
- let [a, b] = elements;
94
+ const [a] = elements;
83
95
 
84
96
  const simpleTypes = [
85
97
  'Identifier',
@@ -92,13 +104,7 @@ module.exports.isSimpleAndNotEmptyObject = (elements) => {
92
104
  if (a && !simpleTypes.includes(a.type))
93
105
  return false;
94
106
 
95
- if (!isObjectExpression(b))
96
- b = elements.at(-1);
97
-
98
- if (!isObjectExpression(b))
99
- return false;
100
-
101
- return b.node.properties.length;
107
+ return checkObject(elements);
102
108
  };
103
109
 
104
110
  module.exports.isIdentifierAndIdentifier = ([a, b]) => {
@@ -172,3 +178,4 @@ module.exports.hasLeadingComment = (path) => path.node?.leadingComments?.length;
172
178
 
173
179
  module.exports.noTrailingComment = (path) => !path.node.trailingComments?.length;
174
180
  module.exports.noLeadingComment = (path) => !path.node.leadingComments?.length;
181
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "13.4.0",
3
+ "version": "13.4.1",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Simplest possible opinionated Babel AST printer for 🐊Putout",