In the course of working with a few scripts, I've noticed many Js
language features I've come to rely on tend to be missing.
For example: Object.(entries|keys|values) and
Array.protype.(find|filter) etc.
The core-js polyfill library does seem to load without any issues into
the platform. How would everyone feel about including it so that it can
be available to everyone closer to in the box?
Where to download the built+minified version https://cdnjs.com/libraries/core-js
The source library.
https://github.com/zloirock/core-js
Note: this is pretty much the core of babel support for legacy browsers, it's been pretty useful in Synchronet as well. It does include some polyfills for ES5 that are already built in, but since some behaviors
change slightly with ES6 it's best to include them all in practice, shouldn't be anything that anyone notices though.
For example, instead of something like...
var newsgroups = hdr.newsgroups.split(',');
for(n in newsgroups)
for(g in msg_area.grp_list)
for(s in msg_area.grp_list[g].sub_list)
if (
msg_area.grp_list[g].sub_list[s].newsgroup.toLowerCase()
== newsgroups[n].toLowerCase()
) {
... msg_area.grp_list[g].sub_list[s] ...
}
You could do...
var newsgroups = hdr.newsgroups.split(',');
Object.values(msg_area.sub)
.filter(function(sub) {
return newsgroups.includes(sub.newsgroup.toLowerCase());
})
.foreach(function(sub) {
... sub ...
});
Of course an updated spidermonkey would allow this to be...
var newsgroups = hdr.newsgroups.split(',');
Object.values(msg_area.sub)
.filter(sub => newsgroups.includes(sub.newsgroup.toLowerCase())
.foreach(sub => {
... sub ...
});
Sysop: | Chris Crash |
---|---|
Location: | Huntington Beach, CA. |
Users: | 577 |
Nodes: | 8 (0 / 8) |
Uptime: | 62:07:54 |
Calls: | 10,734 |
Calls today: | 1 |
Files: | 5 |
Messages: | 442,639 |