Sometimes minor Node versions have little beyond bug fixes, but other times you get some new features, and 21.7 doesnβt disappoint. Node gains a new util.styleText() function for formatting text (including with color!), new functions to work with .env files, multi-line value support for .env files, a crypto.hash() function to more quickly compute digests in one shot (example), and more.
THE NODE.JS CORE TEAM
Please open Telegram to view this post
VIEW IN TELEGRAM
π15 6β€3
function* generateSequence() {
yield 1;
yield 2;
return 3;
}
const generator = generateSequence();
console.log(generator.next());
console.log(generator.next());
console.log(generator.next());
Please open Telegram to view this post
VIEW IN TELEGRAM
π9π€£6β€4
π18 4β€2
A high-level, declarative charting library, built on top of D3 and stack.gl, with over 40 chart types, including 3D charts, statistical graphs, and SVG maps.
PLOTLY, INC.
Please open Telegram to view this post
VIEW IN TELEGRAM
function factorial(n) {
return n <= 1 ? 1 : n * factorial(n - 1);
}
console.log(factorial(5));
Please open Telegram to view this post
VIEW IN TELEGRAM
π€11π1
π22π€£7π€©1 1
A few months ago, we linked to Shikiji, a fork of Shiki that was created to push the project forward. Happily, the creators of both libraries decided to join forces and Shiki 1.0 was born. Itβs a syntax highlighter based on TextMate grammar and themes, the same engine as used by VS Code. The docs are good.
PINE WU, ANTHONY FU
Please open Telegram to view this post
VIEW IN TELEGRAM
π13 4β€2π€1π€©1π€£1
const obj = {
value: 42,
getValue: function() {
return () => {
console.log(this.value);
};
}
};
const getValue = obj.getValue();
getValue();
Please open Telegram to view this post
VIEW IN TELEGRAM
π17
π25π€9 7β€4
If youβve got a collection of large objects to print out, this could be ideal as it can format them into a table, dynamically size the columns as appropriate, sort the output, and let you add styling into the mix (including colors.)
LARS WAECHTER
Please open Telegram to view this post
VIEW IN TELEGRAM
π9β€1 1
const obj = { a: 1, b: 2, c: 3 };
let result = "";
for (const [key, value] of Object.entries(obj)) {
result += key + value;
}
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
β€12 2
π25 12β€5π€£4
We would like to ask for your help. Please boost us to continue sending stories on Telegram.
Please open Telegram to view this post
VIEW IN TELEGRAM
const string = "hello world";
const result = string.replace(/l/g, "");
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
π€12 7β€4
π€£38π14 8β€3
I don't know why Iβve not linked this before, as itβs so useful. Playwright isnβt just a library for controlling browsers from JavaScript, but also includes a tool for generating tests and page navigation code from your own interactions. Hit record, do stuff, and code is written.
MICROSOFT
Please open Telegram to view this post
VIEW IN TELEGRAM
π10 6β€1π€£1
console.log(typeof null);
Please open Telegram to view this post
VIEW IN TELEGRAM
π€£35 16π€9π€©4π2
π€£41π€13π11 7β€1