Gathering detailed insights and metrics for babel-plugin-loop-optimizer
Gathering detailed insights and metrics for babel-plugin-loop-optimizer
Gathering detailed insights and metrics for babel-plugin-loop-optimizer
Gathering detailed insights and metrics for babel-plugin-loop-optimizer
Optimizes statements such as `forEach` and `map` to for loops.
npm install babel-plugin-loop-optimizer
Typescript
Module System
Node Version
NPM Version
JavaScript (97.46%)
TypeScript (2.54%)
Total Downloads
1,136,164
Last Day
164
Last Week
4,325
Last Month
18,913
Last Year
188,937
MIT License
74 Stars
33 Commits
7 Forks
7 Watchers
2 Branches
4 Contributors
Updated on Oct 05, 2023
Minified
Minified + Gzipped
Latest Version
1.4.1
Package Id
babel-plugin-loop-optimizer@1.4.1
Size
2.62 kB
NPM Version
5.0.3
Node Version
7.1.0
Cumulative downloads
Total Downloads
Last Day
-19.2%
164
Compared to previous day
Last Week
-23.5%
4,325
Compared to previous week
Last Month
58.8%
18,913
Compared to previous month
Last Year
74.2%
188,937
Compared to previous year
3
Optimizes .forEach
and .map
statements to for
stements
1$ npm install babel-plugin-loop-optimizer
.babelrc
(Recommended).babelrc
1{ 2 "plugins": ["babel-plugin-loop-optimizer"] 3}
1$ babel --plugins loop-optimizer script.js
1require('babel').transform('code', { 2 plugins: ['loop-optimizer'] 3});
Now you may say "wait, wait, wait!" This optimizes on things that aren't just arrays! My map#forEach
is optimized too! To fix this, add a comment that says // O: KEEP
right before the line on which you use the forEach
. Examples:
var m = new Map();
// O: KEEP
m.forEach(f)
or:
var s = new Set();
// O: KEEP
for (var i = 0; i < 5; s.forEach(f)) {
// ...
}
This is required since it is not possible to determine an object's type at compile-time.
1function timesTwo(arr) { 2 return arr.map(n => n * 2); 3}
to:
1function timesTwo(arr) { 2 var _a = arr; 3 var _f = n => n * 2; 4 var _r = []; 5 6 for (var _i = 0; _i < _a.length; _i++) 7 _r.push(_f(_a[_i], _i, _a)); 8 9 return _r; 10}
If you need any other help, don't hesitate to leave an issue
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 3/20 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
26 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More