JavaScript
32K subscribers
1.03K photos
9 videos
33 files
714 links
A resourceful newsletter featuring the latest and most important news, articles, books and updates in the world of #javascript πŸš€ Don't miss our Quizzes!

Let's chat: @nairihar
Download Telegram
❀4πŸ‘3πŸ”₯2
🀟 Node.js v24.8.0 (Current) Released

The big new feature is added support for inspecting HTTP/2 network calls made from Node in Chrome DevTools. There have also been some cryptography related enhancements and npm gets upgraded to v11.6.

MichaΓ«l Zasso
Please open Telegram to view this post
VIEW IN TELEGRAM
❀8πŸ‘3πŸ”₯2
CHALLENGE

class EventManager {
constructor() {
this.listeners = new Map();
}

addListener(event, callback) {
if (!this.listeners.has(event)) {
this.listeners.set(event, new Set());
}
this.listeners.get(event).add(callback);
}
}

const manager = new EventManager();
const obj = { name: 'Component' };
manager.addListener('click', () => console.log(obj.name));
obj = null;
console.log(manager.listeners.get('click').size);
❀2
πŸ‘€ Feedsmith 2.0: Web Feed Parsing and Generation Library

As well as parsing feeds of various types, you can also create RSS, Atom, JSON Feed, and OPML files with many common namespaces (iTunes, Podcast, Media RSS, Dublin Core, etc.) – here’s a quick start tutorial for using it both in browsers or Node. GitHub repo.

Maciej Lamberski
Please open Telegram to view this post
VIEW IN TELEGRAM
❀4πŸ‘3πŸ”₯1
CHALLENGE

const multiply = (a) => (b) => (c) => a * b * c;

const step1 = multiply(2);
const step2 = step1(3);
const result1 = step2(4);

const result2 = multiply(2)(3)(4);

const partialMultiply = multiply(5);
const result3 = partialMultiply(2)(3);

const doubler = multiply(2)(1);
const result4 = doubler(7);

console.log(result1, result2, result3, result4);
❀1
πŸ‘3❀2πŸ”₯1
🌟 Behind the Scenes of bun install" is an epic post by Lydia Hallie of the Bun project covering not only what Bun has done to make its package installation mechanism fast, but also the process and pain points of package installation more generally.

bun
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ€”3❀2πŸ‘2
CHALLENGE

const moduleCache = new Map();

async function loadModule(name) {
if (moduleCache.has(name)) {
return moduleCache.get(name);
}

const module = await Promise.resolve({
default: () => `Module ${name} loaded`,
version: '1.0.0'
});

moduleCache.set(name, module);
return module;
}

const results = [];
loadModule('auth').then(m => results.push(m.default()));
loadModule('auth').then(m => results.push(m.version));
loadModule('utils').then(m => results.push(m.default()));

setTimeout(() => console.log(results.join(', ')), 0);
πŸ€”4❀1
πŸ‘€ The 'Shai-Hulud' npm Supply Chain Attack Rumbles On

Now named after a term for the sandworms of the Dune universe, the ongoing malicious supply chain attack affecting the npm ecosystem has grown in scale with hundreds of packages affected in an attempt to exfiltrate tokens and secrets from developers’ machines.

Pandya, van der Zee, and Brown (Socket)
Please open Telegram to view this post
VIEW IN TELEGRAM
❀6πŸ‘2πŸ”₯1
CHALLENGE

const nums = [1, 2, 3, 4, 5];
const result = nums
.filter(n => n > 2)
.map(n => n * 2)
.reduce((acc, n) => {
acc.push(n + 1);
return acc;
}, [])
.slice(1);

console.log(result);
console.log(nums);
🀩 Fetch Streams are Great, But Not for Measuring Upload/Download Progress

Fetch upload streams seem well-suited for tracking the progress of uploads, but as Jake notes β€œjust because stuff is taken from the stream doesn’t mean it’s yet been sent over the network”. He also touches on an issue relating to measuring download progress using response streams.

Jake Archibald
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ€”6πŸ”₯3πŸ‘2
CHALLENGE

const cache = new Map();

function createHandler(id) {
const data = { id, value: new Array(1000).fill(id) };
cache.set(id, data);

return function(action) {
if (action === 'get') return data;
if (action === 'clear') cache.delete(id);
};
}

const handler1 = createHandler('user-1');
const handler2 = createHandler('user-2');

handler1('clear');
console.log(cache.size);
console.log(handler1('get').id);
❀3πŸ‘1πŸ”₯1
⛽️ Massive Supply Chain Attack Hijacks ctrl/tinycolor With 2 Million Downloads and Other 40 NPM Packages

A sophisticated and widespread supply chain attack has struck the NPM ecosystem, compromising the popular @ctrl/tinycolor package, which is downloaded over 2 million times per week.

Guru Baran
Please open Telegram to view this post
VIEW IN TELEGRAM
❀4πŸ”₯3πŸ‘1
CHALLENGE

const sym1 = Symbol('test');
const sym2 = Symbol('test');
const obj = {
[sym1]: 'value1',
[sym2]: 'value2',
regular: 'value3'
};

const sym3 = Symbol.for('global');
const sym4 = Symbol.for('global');

console.log(sym1 === sym2);
console.log(sym3 === sym4);
console.log(Object.keys(obj).length);
console.log(Object.getOwnPropertySymbols(obj).length);
❀3πŸ‘1πŸ”₯1
πŸ₯³ IINA is a popular, open-source media player for macOS and it has just added a JavaScript-based plugin system to let users extend its functionality.
Please open Telegram to view this post
VIEW IN TELEGRAM
❀2πŸ‘1πŸ”₯1