@putout/plugin-for-of 10.1.0 β 12.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 +6 -6
- package/lib/for-entries-n/index.js +2 -1
- package/package.json +12 -14
package/README.md
CHANGED
|
@@ -165,9 +165,9 @@ for (const item of arguments) {
|
|
|
165
165
|
|
|
166
166
|
## reduce
|
|
167
167
|
|
|
168
|
-
> - The
|
|
168
|
+
> - The `reduce()` method executes a user-supplied **reducer** callback function on each element of the array, in order, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the array is a single value.
|
|
169
169
|
>
|
|
170
|
-
> (c) MDN
|
|
170
|
+
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
|
|
171
171
|
|
|
172
172
|
You should always look at second argument of a **reducer** since it changes logic drastically and should read back and forth a couple times to understand what is going on.
|
|
173
173
|
|
|
@@ -177,13 +177,13 @@ You should always look at second argument of a **reducer** since it changes logi
|
|
|
177
177
|
|
|
178
178
|
Check it out in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/107751499a4bbdd83b9181444d8bdbbd/8d3b646a3df0025d564e2bb141cc7f6a6bb1b3a5).
|
|
179
179
|
|
|
180
|
-
|
|
180
|
+
### β Example of incorrect code
|
|
181
181
|
|
|
182
182
|
```js
|
|
183
183
|
const result = list.reduce((a, b) => a + b, 1);
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
-
|
|
186
|
+
### β
Example of correct code
|
|
187
187
|
|
|
188
188
|
```js
|
|
189
189
|
let sum = 1;
|
|
@@ -267,9 +267,9 @@ for (const x of y) {}
|
|
|
267
267
|
|
|
268
268
|
## for
|
|
269
269
|
|
|
270
|
-
> The
|
|
270
|
+
> The `for` statement creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement to be executed in the loop.
|
|
271
271
|
>
|
|
272
|
-
> (c) MDN
|
|
272
|
+
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for)
|
|
273
273
|
|
|
274
274
|
### for-n
|
|
275
275
|
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
const {
|
|
8
8
|
compare,
|
|
9
9
|
getTemplateValues,
|
|
10
|
+
getBinding,
|
|
10
11
|
} = operator;
|
|
11
12
|
|
|
12
13
|
const {isBlockStatement} = types;
|
|
@@ -47,7 +48,7 @@ export const filter = (path) => {
|
|
|
47
48
|
if (!comparePrevSiblings(path, assignN(__n)))
|
|
48
49
|
return false;
|
|
49
50
|
|
|
50
|
-
const nBinding =
|
|
51
|
+
const nBinding = getBinding(path, __n.name);
|
|
51
52
|
|
|
52
53
|
if (nBinding.references > 1)
|
|
53
54
|
return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-for-of",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.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 apply for...of",
|
|
@@ -31,31 +31,29 @@
|
|
|
31
31
|
"for-of"
|
|
32
32
|
],
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@putout/eslint-flat": "^
|
|
34
|
+
"@putout/eslint-flat": "^4.0.0",
|
|
35
35
|
"@putout/plugin-conditions": "*",
|
|
36
|
-
"@putout/plugin-
|
|
36
|
+
"@putout/plugin-destructuring": "*",
|
|
37
37
|
"@putout/plugin-remove-console": "*",
|
|
38
38
|
"@putout/plugin-remove-empty": "*",
|
|
39
39
|
"@putout/plugin-remove-nested-blocks": "*",
|
|
40
|
-
"@putout/plugin-remove-unreferenced-variables": "*",
|
|
41
|
-
"@putout/plugin-remove-unused-variables": "*",
|
|
42
|
-
"@putout/plugin-remove-useless-arguments": "*",
|
|
43
40
|
"@putout/plugin-remove-useless-continue": "*",
|
|
44
|
-
"@putout/
|
|
45
|
-
"
|
|
46
|
-
"eslint": "^
|
|
41
|
+
"@putout/plugin-variables": "*",
|
|
42
|
+
"@putout/test": "^15.0.0",
|
|
43
|
+
"eslint": "^10.0.0",
|
|
47
44
|
"eslint-plugin-n": "^17.0.0",
|
|
48
|
-
"eslint-plugin-putout": "^
|
|
49
|
-
"madrun": "^
|
|
45
|
+
"eslint-plugin-putout": "^31.0.0",
|
|
46
|
+
"madrun": "^13.0.0",
|
|
50
47
|
"montag": "^1.2.1",
|
|
51
|
-
"nodemon": "^3.0.1"
|
|
48
|
+
"nodemon": "^3.0.1",
|
|
49
|
+
"superc8": "^12.0.0"
|
|
52
50
|
},
|
|
53
51
|
"peerDependencies": {
|
|
54
|
-
"putout": ">=
|
|
52
|
+
"putout": ">=42"
|
|
55
53
|
},
|
|
56
54
|
"license": "MIT",
|
|
57
55
|
"engines": {
|
|
58
|
-
"node": ">=
|
|
56
|
+
"node": ">=22"
|
|
59
57
|
},
|
|
60
58
|
"publishConfig": {
|
|
61
59
|
"access": "public"
|