@putout/plugin-types 10.0.0 → 10.2.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/README.md +1 -0
- package/lib/convert-typeof-to-is-type/index.js +10 -1
- package/lib/declare/index.js +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {operator} from 'putout';
|
|
1
|
+
import {operator, types} from 'putout';
|
|
2
|
+
|
|
3
|
+
const {isCallExpression} = types;
|
|
2
4
|
|
|
3
5
|
const {
|
|
4
6
|
compare,
|
|
@@ -37,6 +39,7 @@ const BODIES = {
|
|
|
37
39
|
error: `__a instanceof Error`,
|
|
38
40
|
array: `__a instanceof Array`,
|
|
39
41
|
object: `__a instanceof Object`,
|
|
42
|
+
regexp: `__a instanceof RegExp`,
|
|
40
43
|
equalUndefined: '__a === undefined',
|
|
41
44
|
};
|
|
42
45
|
|
|
@@ -51,6 +54,7 @@ const NOT_BODIES = {
|
|
|
51
54
|
error: `!(__a instanceof Error)`,
|
|
52
55
|
array: `!(__a instanceof Array)`,
|
|
53
56
|
object: `!(__a instanceof Object)`,
|
|
57
|
+
regexp: `!(__a instanceof RegExp)`,
|
|
54
58
|
equalUndefined: '__a !== undefined',
|
|
55
59
|
};
|
|
56
60
|
|
|
@@ -76,6 +80,7 @@ export const replace = () => ({
|
|
|
76
80
|
[BODIES.error]: 'isError(__a)',
|
|
77
81
|
[BODIES.array]: 'isArray(__a)',
|
|
78
82
|
[BODIES.object]: 'isObject(__a)',
|
|
83
|
+
[BODIES.regexp]: 'isRegExp(__a)',
|
|
79
84
|
[BODIES.equalUndefined]: 'isUndefined(__a)',
|
|
80
85
|
[NOT_BODIES.function]: '!isFn(__a)',
|
|
81
86
|
[NOT_BODIES.string]: '!isString(__a)',
|
|
@@ -87,6 +92,7 @@ export const replace = () => ({
|
|
|
87
92
|
[NOT_BODIES.error]: '!isError(__a)',
|
|
88
93
|
[NOT_BODIES.array]: '!isArray(__a)',
|
|
89
94
|
[NOT_BODIES.object]: '!isObject(__a)',
|
|
95
|
+
[NOT_BODIES.regexp]: 'isRegExp(__a)',
|
|
90
96
|
[NOT_BODIES.equalUndefined]: '!isUndefined(__a)',
|
|
91
97
|
});
|
|
92
98
|
|
|
@@ -97,6 +103,9 @@ function check({__a, __b}, path) {
|
|
|
97
103
|
if (__b && isBind(path, extract(__b)))
|
|
98
104
|
return false;
|
|
99
105
|
|
|
106
|
+
if (isCallExpression(__a))
|
|
107
|
+
return true;
|
|
108
|
+
|
|
100
109
|
return getBindingPath(path, __a);
|
|
101
110
|
}
|
|
102
111
|
|
package/lib/declare/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-types",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin adds ability to transform code related to types assertions",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"@putout/plugin-declare-before-reference": "*",
|
|
36
36
|
"@putout/plugin-putout": "*",
|
|
37
37
|
"@putout/test": "^15.0.0",
|
|
38
|
-
"c8": "^10.0.0",
|
|
39
38
|
"eslint": "^10.0.0",
|
|
40
39
|
"eslint-plugin-n": "^17.0.0",
|
|
41
40
|
"eslint-plugin-putout": "^31.0.0",
|
|
42
41
|
"madrun": "^13.0.0",
|
|
43
42
|
"montag": "^1.2.1",
|
|
44
|
-
"nodemon": "^3.0.1"
|
|
43
|
+
"nodemon": "^3.0.1",
|
|
44
|
+
"superc8": "^12.0.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"putout": ">=42"
|