
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
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
The npm package babel-plugin-transform-for-of-without-iterator receives a total of 2 weekly downloads. As such, babel-plugin-transform-for-of-without-iterator popularity was classified as not popular.
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.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.