@putout/plugin-types 1.6.0 → 2.0.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
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const {operator} = require('putout');
|
|
4
|
-
const {
|
|
5
|
-
compare,
|
|
6
|
-
getBindingPath,
|
|
7
|
-
} = operator;
|
|
4
|
+
const {compare, getBindingPath} = operator;
|
|
8
5
|
|
|
9
6
|
const NAMES = {
|
|
10
7
|
function: 'isFn',
|
|
@@ -15,6 +12,8 @@ const NAMES = {
|
|
|
15
12
|
symbol: 'isSymbol',
|
|
16
13
|
};
|
|
17
14
|
|
|
15
|
+
const GENERAL = 'typeof __a === "__b"';
|
|
16
|
+
|
|
18
17
|
const BODIES = {
|
|
19
18
|
function: `typeof __a === 'function'`,
|
|
20
19
|
string: `typeof __a === 'string'`,
|
|
@@ -26,7 +25,7 @@ const BODIES = {
|
|
|
26
25
|
|
|
27
26
|
module.exports.report = () => `Use function to check type instead of 'typeof'`;
|
|
28
27
|
module.exports.match = () => ({
|
|
29
|
-
|
|
28
|
+
[GENERAL]: ({__a, __b}, path) => {
|
|
30
29
|
if (path.parentPath.isFunction())
|
|
31
30
|
return false;
|
|
32
31
|
|
|
@@ -36,10 +35,7 @@ module.exports.match = () => ({
|
|
|
36
35
|
if (isBind(path, __b.value))
|
|
37
36
|
return false;
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
return false;
|
|
41
|
-
|
|
42
|
-
return true;
|
|
38
|
+
return Boolean(getBindingPath(path, __a));
|
|
43
39
|
},
|
|
44
40
|
});
|
|
45
41
|
|
|
@@ -9,6 +9,8 @@ module.exports.replace = () => ({
|
|
|
9
9
|
'!!__a ? __b : __c': '__a ? __b : __c',
|
|
10
10
|
'!!__a && __b': '__a && __b',
|
|
11
11
|
'!!__a.includes(__b)': '__a.includes(__b)',
|
|
12
|
+
'!!__a.startsWith(__b)': '__a.startsWith(__b)',
|
|
13
|
+
|
|
12
14
|
'while(!!__a) __b': 'while(__a) __b',
|
|
13
15
|
'do __a; while(!!__b)': 'do __a; while(__b)',
|
|
14
16
|
'for (__a; !!__b; __c) __d': 'for (__a; __b; __c) __d',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "commonjs",
|
|
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",
|
|
@@ -32,18 +32,18 @@
|
|
|
32
32
|
],
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@putout/plugin-putout": "*",
|
|
35
|
-
"@putout/test": "^
|
|
36
|
-
"c8": "^
|
|
35
|
+
"@putout/test": "^7.0.0",
|
|
36
|
+
"c8": "^8.0.0",
|
|
37
37
|
"eslint": "^8.0.1",
|
|
38
38
|
"eslint-plugin-n": "^16.0.0",
|
|
39
|
-
"eslint-plugin-putout": "^
|
|
39
|
+
"eslint-plugin-putout": "^18.0.0",
|
|
40
40
|
"lerna": "^6.0.1",
|
|
41
41
|
"madrun": "^9.0.0",
|
|
42
42
|
"montag": "^1.2.1",
|
|
43
|
-
"nodemon": "^
|
|
43
|
+
"nodemon": "^3.0.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"putout": ">=
|
|
46
|
+
"putout": ">=30"
|
|
47
47
|
},
|
|
48
48
|
"license": "MIT",
|
|
49
49
|
"engines": {
|