What’s New in NodeJS v16?
The NodeJS latest version 16 had been rolled out, and it’s already making headlines in our NodeJS developer community. Catch detailed updates here of what's new!
Join the DZone community and get the full member experience.
Join For FreeA week ago, the Node js latest version 16 had been rolled out, and it’s already making some vast headlines about it in our NodeJS developer community.
Many new features have been introduced; however, mainly if you are a user of NodeJS 15, the new features are more like an upgrade to the last version and moving in the direction of the LTS branch. In other words, it can imply that it has become the bridge between Node 15 and the future version of NodeJS, Long term support Release.
If we would have to start with the first update that would be npm V7!
npm v7
Npm has gone to some substantial underground improvements to make as a fresh upgrade in Node 16 version. You can now install peer dependencies simultaneously with the regular ones. It has been considered one of the exceptional changes in the workflow of the NodeJS Developing process.
A more reliable package known as -lock.json ensures more reliability to deterministic builds. Also, it is helpful to rebuild your package tree from the beginning. Overall, npm v7 will significantly affect performance improvisation and make your workflow more efficient.
Version Update From v8 to v8 9.0
Considering the prominent objective in keeping NodeJS up to date with the Javascripts latest features, they have updated Node with v8 to v8 9.0 to enable access to the latest upgrade.
With the profound performance enhancements, it also brings the introduction of new features.
For instance, in particular, the improvement has brought ECMAScript RegExp to match the indices; you find the indices array property through .indices and then match both the objects when it shows /d as the regular expression flag.
> const matchObj = /(Java)(Script)/d.exec(‘JavaScript’);
undefined
> matchObj.indices
[ [ 0, 10 ], [ 0, 4 ], [ 4, 10 ], groups: undefined ]
> matchObj.indices[0]; // Match
[ 0, 10 ]
> matchObj.indices[1]; // First capture group
[ 0, 4 ]
> matchObj.indices[2]; // Second capture group
[ 4, 10 ]
NodeJS v16 has also introduced a particular feature to deal with regular expressions. Access to the indices array could be possible through the indices property.
const regex = /(a)(b)/d;
const match = regex.exec(“xy”);
console.log(match.indices[0]); // [0, 2]
console.log(match.indices[1]); // [0, 1]
console.log(match.indices[2]); // [1, 2]
Other Significant Changes in Nodejs v16
Nodejs version 16 shows a profound inclination towards Timers Promises API as it ensures the status is stable. Moreover, these APIs promise timer proportions in the Javascript timer function, which return Native has provided.
One must need to use util.promisify() to remove the need to use an alternative set of timers:
import { setTimeout } from ‘timers/promises’;
async function run() {
await setTimeout(5000);
console.log(‘Hello, World!’);
}
run();
Platform Minimums
Nodejs uses predefined binary for several platforms, and with each significant release, the appropriate toolchain has been raised and used when necessary.
This is the first significant release where the binaries have been shipped to Apple Silicon. In contrast, separate tarballs will be provided for intel and ARM.
Introduction of New Deprecations in Nodejs v16
The latest runtime deprecation has been launched with this major release of the Latest Nodejs version. It relatively aims at not provoking any disruptions in the ecosystem due to any changes.
A significant amount of popular ecosystems has to provide excess information before landing at any such changes.
In the final analysis, in many ways, the launch of Nodejs version 16 brought significant changes leading us to the next LTS channel from the v8 version features. Moreover, version 15 will be remained supported till 1 June 2021. If you want to download the Node js latest version, you can download it from here.
Although it does need a professional expert touch to get the optimum advantage of this latest version to your projects. And the best way is to hire NodeJs developer to get your project affiliated with the latest upgrades and features.
Published at DZone with permission of Arohi Adhyaru. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments