ES.nextNews: the latest in JavaScript and cross-platform tools
Curated by Dr. Axel Rauschmayer and Johannes Weber.

ES.next News

The latest in JavaScript and cross-platform tools

Node v18.3.0 (current): util.parseArgs() and more
nodejs.org@bengl, @nodejs
The highlight of this release is the new function util.parseArgs():
import { parseArgs } from 'node:util';
const args = ['-f', '--bar', 'b'];
const options = {
  foo: {
    type: 'boolean',
    short: 'f'
  },
  bar: {
    type: 'string'
  }
};
const {
  values,
  positionals
} = parseArgs({ args, options });
console.log(values, positionals);
// Prints: [Object: null prototype] { foo: true, bar: 'b' } []


Processing Arrays non-destructively: for-of vs. .reduce() vs. .flatMap()
2ality.com@2ality
This blog post compares three JavaScript constructs for processing Arrays non-destructively: for-of loops, the Array method .reduce(), and the Array method .flatMap(). It explains how the latter two work. To get a feeling for how these constructs differ, the following functionality is implemented with each of them (if possible):
  • Filtering an input Array to produce an output Array
  • Mapping each input Array element to one output Array element
  • Expanding each input Array element to zero or more output Array elements
  • Filter-mapping (filtering and mapping in one step)
  • Computing a summary for an Array
  • Finding an Array element
  • Checking a condition for all Array elements


DevSecCon24 is back for 2022!
devseccon.com Sponsor
What stinks? Explore how developer hygiene impacts security with Peter Chestna, CISO of North America at Checkmarx at DevSecCon24 - the only free, global conference dedicated to DevSecOps. Register now for free!


relative-deps: managing local dependencies without the limitations of npm/yarn link
github.com@mweststrate
This library “installs dependencies from a local checkout, and keeps them in sync, without the limitations of npm/yarn link”.


How we converted our Node.js library to Deno (using Deno)
www.edgedb.comgithub/jaclarke, @edgedatabase
“At EdgeDB, we built and maintain a first-party client library for Node.js that’s available as the edgedb module on NPM. However, Deno uses a totally different set of practices to handle dependencies, namely direct URL imports from public package registries like deno.land/x. We set out to find a simple way to “Denoify” our codebase; that is, generate a Deno-compatible module from our existing Node.js implementation with minimal refactoring.”

They used Deno’s Node.js compatibility library and wrote a codemod to add the filename extension .ts to imports, change usages of global Node.js variables such as process and Buffer to Deno-specific imports, etc.




Looking for deeply qualified employees or customers? Advertise on ES.next News!
ES.next News reaches over 14,000 highly skilled and motivated developers. We take their trust seriously and have high editorial standards.
Check out our media data and get directly in touch with us.
Follow on Twitter

This email was sent to {{ email | default }}. Want to change how you receive these emails?
You can unsubscribe from this list