Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
babel-plugin-transform-for-of-without-iterator
Advanced tools
Transpiles for(...of...) syntax without Symbol.iterator
By default, Babel transpiles for-or syntax to use Symbol.iterator
. Pretty ironic from a tool that's supposed to make your code backwards compatible. And now you have to import ~100kB Symbol
polyfill.
Well not anymore.
npm install babel-plugin-transform-for-of-without-iterator --save-dev
and add it to the plugin list
{
"plugins": ["babel-plugin-transform-for-of-without-iterator"]
}
Wraps the right side of the "of" into Array.from
Supports:
NodeList
)Set
Map
map.entries()
and friendsfor (let [key, val] of map.entries()) {
console.log('map entry broken', key, val)
}
var _arrayified = map.entries();
if (!Array.isArray(_arrayified)) {
_arrayified = Array.from(_arrayified);
}
for (var _i = 0; _i < _arrayified.length; _i++) {
var _arrayified$_i = _arrayified[_i];
var key = _arrayified$_i[0];
var val = _arrayified$_i[1];
console.log('map entry broken', key, val);
}
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = map.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _ref2 = _step.value;
var _key = _ref2[0];
var _val = _ref2[1];
console.log('map entry broken', _key, _val);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
FAQs
Transpiles for(...of...) syntax without Symbol.iterator
We found that babel-plugin-transform-for-of-without-iterator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.