@putout/plugin-printer 8.18.0 → 8.19.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {operator, types} from 'putout';
|
|
2
|
+
import {isTypeExists} from '#types';
|
|
2
3
|
|
|
3
4
|
const {
|
|
4
5
|
isIdentifier,
|
|
@@ -48,6 +49,20 @@ function createWhere(value) {
|
|
|
48
49
|
if (value.startsWith('-: !') && !value.includes('->'))
|
|
49
50
|
where.push('after-colon');
|
|
50
51
|
|
|
52
|
+
if (value.startsWith('+: ') && !value.includes('->')) {
|
|
53
|
+
const type = value.replace('+: ', '');
|
|
54
|
+
|
|
55
|
+
if (isTypeExists(type))
|
|
56
|
+
where.push('before-type');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (value.startsWith('-: ') && !value.includes('->')) {
|
|
60
|
+
const type = value.replace('-: ', '');
|
|
61
|
+
|
|
62
|
+
if (isTypeExists(type))
|
|
63
|
+
where.push('before-type');
|
|
64
|
+
}
|
|
65
|
+
|
|
51
66
|
return where;
|
|
52
67
|
}
|
|
53
68
|
|
|
@@ -55,5 +70,8 @@ function addArrow(value, where) {
|
|
|
55
70
|
if (where.includes('after-colon'))
|
|
56
71
|
value = value.replace(': !', ': -> !');
|
|
57
72
|
|
|
73
|
+
if (where.includes('before-type'))
|
|
74
|
+
value = value.replace(': ', ': -> ');
|
|
75
|
+
|
|
58
76
|
return value;
|
|
59
77
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-printer",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.19.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin adds support of transformations for @putout/printer",
|