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
69.5
Supply Chain
85.2
Quality
75.6
Maintenance
100
Vulnerability
100
License
JavaScript (97.46%)
TypeScript (2.54%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
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
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
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
project is not fuzzed
Details
Reason
security policy file not detected
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
25 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-05-05
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