Skip to content

module: addBuiltinLibsToObject refactoring

  • Replace forEach loop by for loop for several reasons. One of them being performance. Loop over a small array is fast anyway, but this will make code more consistent across the project. Feels like Node.js is trying to be as fast as possible

  • Move setReal function definition out of the loop and make it bindable. Defining a function inside loop is considered bad practice in general.

  • Predefine configurable and enumerable as these are staying consistent across the function.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)
  • internal/module

Merge request reports

Loading