Comments (15)
Thanks! Just fixed š . Please re-install š. Is it works for you?
from putout.
It's better now, but I don't see any transformation and the forEach still exists
āÆ node tt.js
(a.forEach((aa) => d.push(aa)), b.forEach((bb) => d.push(bb)));
----------------------
(a.forEach((aa) => d.push(aa)), b.forEach((bb) => d.push(bb)));
from putout.
What kind of transformation you expect to see here?
from putout.
in my opinion, it should be the most appropriate
(function() {
for (const aa of a)
d.push(aa);
}(),
function() {
for (const bb of b)
d.push(bb);
}())
can correct me if you think otherwise
from putout.
not sure if this applies to this task but I'll write here first
for code
const js = `const z=a.forEach(aa=>d.push(aa))`;
result
āÆ node tt.js
const z = a.forEach((aa) => d.push(aa));
----------------------
const z;
I expect something like
const z = function() {
for (const bb of b)
d.push(bb);
}()
from putout.
Just fixed š . Please re-install š. Is it works for you?
Here is a new rule for merging loops: minify/merge-loops.
About const z=a.forEach(aa=>d.push(aa))
, forEach()
returns nothing so better to keep this code as is.
from putout.
But it removes the loop and without minification it causes a push
and after that it doesn't do anything
from putout.
Have you tried new version?
from putout.
Oh yes, the version was not the last
now I have a row without changes
I just thought that plugin-for-of must strictly change to for-of
but if it is skipped for minification then it seems it should just use a more complex condition than just replacing or skipping it
from putout.
Look, @putout/plugin-for-of used both in Putout linter and Minify, so when trapped on SequenceExpression it just skippes transformation, since we have @putout/plugin-extract-sequence-expression
which will do the thing first.
About your case:
a.forEach(aa=>d.push(aa)),
b.forEach(bb=>d.push(bb))`;
Now with help of @putout/plugin-minify
it will be transformed to:
for (const aa of [...a, ...b]) {
d.push(aa);
}
And then all whitespaces will be reduced.
it seems it should just use a more complex condition than just replacing or skipping it
What do you suggest?
from putout.
Thank you, I understand now, thanks for the solution
from putout.
And could you update the minify
version as well?
from putout.
It is updated, just re-install it
from putout.
I see that the last version was a month ago
https://www.npmjs.com/package/minify?activeTab=versions
from putout.
Iām using semantic versioning, just re-install minify
and it will update all dependencies.
from putout.
Related Issues (20)
- TypeScript union type as a key turns into extends expression HOT 2
- TypeScript interface `extends` gets removed HOT 1
- Eslint Plugin Relying on Stylistic HOT 6
- 404 Page of Node v12 link in README. HOT 2
- convert-commonjs-to-esm/exports not working HOT 8
- Double quotes to single quotes conversion creates syntax error HOT 3
- question: how can i disable all plugins that are not in the rulesdir? HOT 3
- [printer] [bug] HOT 2
- Question: Reverse mode HOT 4
- Incorrect order of initialization of variables HOT 4
- Incorrect removing of an expression HOT 2
- ignore test files HOT 5
- path is missing for ruler toggler HOT 2
- babel config is not loaded. HOT 13
- how to run just specific rules HOT 1
- putout ignores camelCased paths HOT 1
- Using async functions in replacer HOT 6
- Mistaken removal of semi from unnamed prop types in FC HOT 12
- @putout/printer: Removed useful comma in TS HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from putout.