@putout/printer 7.2.0 → 7.3.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 +5 -0
- package/README.md +5 -2
- package/lib/tokenize/is.js +1 -1
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
[CoverageURL]: https://coveralls.io/github/putoutjs/printer?branch=master
|
|
10
10
|
[CoverageIMGURL]: https://coveralls.io/repos/putoutjs/printer/badge.svg?branch=master&service=github
|
|
11
11
|
|
|
12
|
-
Prints [**Babel AST**](https://github.com/coderaiser/estree-to-babel) to readable **JavaScript**.
|
|
12
|
+
Prints [**Babel AST**](https://github.com/coderaiser/estree-to-babel) to readable **JavaScript**.
|
|
13
|
+
Use 🐊[**Putout**](https://github.com/coderaiser/putout) to parse your code.
|
|
14
|
+
|
|
15
|
+
You may also use [Babel 8](https://github.com/putoutjs/babel) with [`estree-to-babel`](https://github.com/coderaiser/estree-to-babel) for **ESTree** and **Babel AST** to put `.extra.raw` to `.raw` (which is simpler for transforms, no need to use [Optional Chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) and add extra values every time).
|
|
13
16
|
|
|
14
17
|
- ☝️ Similar to **Recast**, but [twice faster](#speed-comparison), also simpler and easier in maintenance, since it supports only **Babel**.
|
|
15
18
|
- ☝️ As opinionated as **Prettier**, but has more user-friendly output and works directly with **AST**.
|
|
@@ -52,7 +55,7 @@ To benefit from it.
|
|
|
52
55
|
|
|
53
56
|
```js
|
|
54
57
|
const {print} = require('@putout/printer');
|
|
55
|
-
const {parse} = require('
|
|
58
|
+
const {parse} = require('putout');
|
|
56
59
|
const ast = parse('const a = (b, c) => {const d = 5; return a;}');
|
|
57
60
|
|
|
58
61
|
print(ast);
|
package/lib/tokenize/is.js
CHANGED
|
@@ -43,7 +43,7 @@ module.exports.isParentLast = (path) => isLast(path.parentPath);
|
|
|
43
43
|
|
|
44
44
|
module.exports.isIndented = (path = {}) => {
|
|
45
45
|
const {parentPath, node} = path;
|
|
46
|
-
return node.loc
|
|
46
|
+
return node.loc?.start.column !== parentPath.node.loc.start.column;
|
|
47
47
|
};
|
|
48
48
|
module.exports.isCoupleLines = isCoupleLines;
|
|
49
49
|
|
package/package.json
CHANGED