Replaced the redundant map function and removed the unused variable #1919
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation, if we replacy all items, on null, we try to save sourcesContent array length but for what
I only found one place when we use length, when check Content
postcss/lib/previous-map.js
Lines 133 to 138 in 219dd75
But you don't have this case in unit test, and i don't know need thik about this case because all case when we use this func we after nofing do with this data
All rigth, let's imagine what we really check length, next question "we only check wath our array is not empty" or "we use length of array for calcuted/itteration"?
It's important, because it's potential for optimization
If we use after that itterator based on sourcesContent length, we'll leave map.sourcesContent.map(() => null), but if we only check wath our array is not empty, we can create constant operation and write just [ null ]
Also i check code in "source-map-js" and applySourceMap() don't work with that key
P.s. i'm not understand why in a test:size we get the result
map.sourcesContent.map(() => null) => 14.66kB
null => 14.67kB