Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
es6-comprehensions
Advanced tools
Transforms ES6 Array Comprehensions to ES5 compliant equivalent.
Compiles JavaScript array comprehensions (proposed in ES6) to ES5-compatible syntax. For instance:
var squared = [ for (x of [1,2,3,4,5]) if (x > 2) x * x ];
compiles to:
var $__getIterator = function(iterable) { ... };
var $__arrayIterator = function(array) { ... };
var squared = function() {
var $__result = [];
for (var $__0 = $__getIterator([1,2,3,4,5]), $__1; !($__1 = $__0.next()).done; ) {
var x = $__1.value;
if (x > 2) {
$__result.push(x * x);
}
}
return $__result;
}.bind(this)();
I'm glad to inform you that es6-comprehensions is now a part of es-next project.
For more information check out the current draft for ECMAScript 6.
Please notice that the syntax has changed and many resources is still using the old one.
$ npm install es6-comprehensions [--save]
Array comprehensions progressed to the Draft ECMAScript 6 Specification. It doesn't mean that there will be no changes or that array comprehensions will be included in the final ES6 Specification.
ES6 defines also iterators that can be used together with for-of loops that can be used in array comprehensions. This translator does not support iterators in for-of
loops. It translates for-of
loops to plain for
loops. Thus, it supports only plain JS arrays.
for
loop with forEach
method. It will result in more compact code,npm install
.Pull requests are highly appreciated.
esprima-fb
.for...of
loop. (Thanks @vslinko for PR.) Important! Generated code contains two more necessary functions.this
in an array comprehension. An example can be found in a test file. (Thanks @vslinko for PR.)BSD
FAQs
Transforms ES6 Array Comprehensions to ES5 compliant equivalent.
We found that es6-comprehensions 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.