26

Is there a mapping somewhere from Node.js version, e.g. 0.10, or 14, to the corresponding ECMAScript version, e.g. ES5, ES2020?

As this question is closed, I can't post the solution I came up with as an answer, so it is here instead.

@bevry/node-versions includes fetchESVersionForNodeVersion(nodeVersion: string): Promise<string> which will fetch the ECMAScript version that was ratified by the time that the Node.js version was released.

balupton
  • 47,113
  • 32
  • 131
  • 182
  • 2
    https://node.green/. See also e.g. https://stackoverflow.com/q/5139168/3001761. – jonrsharpe Oct 26 '20 at 22:44
  • There is no such thing as a direct mapping because no single node.js version represents a 100% transition from one version of the ECMAScript specification to a new version. Instead, it is a gradual adding of new language features over time and over many versions. As you've now received two recommendations for, node.green will show you the feature by feature transition between nodejs versions. – jfriend00 Oct 26 '20 at 23:52
  • node.green is not really very useful, I find it very confusing for making a decision on which exmascript version to target given a base nodejs version. – sorin Jan 03 '23 at 17:51
  • if you googled here you probably want this: https://stackoverflow.com/a/57607634 – quant2016 Apr 03 '23 at 09:42
  • The best resource I have found so far is on tsconfig github repo, e.g.: https://github.com/tsconfig/bases/blob/main/bases/node16.json . Here you can find typescript config files for various node versions including it's corresponding javascript version (look at the target field). – Vincent Pazeller Jul 26 '23 at 10:01
  • @VincentPazeller if generating the right scaffolding for the various node versions is your use case, take a look at https://github.com/bevry/boundation — it's what I coded https://github.com/bevry/node-versions for – balupton Jul 27 '23 at 14:28

1 Answers1

11

Which features ship with which Node.js version by default?

The website node.green provides an excellent overview over supported ECMAScript features in various versions of Node.js, based on kangax's compat-table.

Source: https://nodejs.org/en/docs/es6/

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
iwaduarte
  • 1,600
  • 17
  • 23