I am reviewing an old codebase which was ES5 although I am cleaning it up so that the minimum supported version is ES2015. Having reviewed the libraries, there are many polyfills included from core-js which I need to detangle.
How do I find out what features belong to what specification so that I may know what polyfills are outside of my target specification?
For example, straight away there is one for Array.includes.
By referencing the MDN docs for Array.includes, I find a link to the specification however the specification seems to be a full ES2022 document and looking at the link, I am unsure at what point includes was added. In this case I know it is however, looking at the significant list of polyfills, I will not know that for all entries that are being polyfilled.ES2015
How can I tell what's in ES2015 rather than what's in ES2016 and above?
There are a few ways:
The introduction to the editor's draft specification in recent versions has a few paragraphs describing what was added in what release. For example:
ES2016 also included support for a new exponentiation operator and adds a new method to Array.prototype called includes.
(not the best example because work on ES2016 mostly consisted of process and specification tooling improvements and big things that weren't going to be ready in time for the annual cut-off, so not that much was added to the language for standard library)
and
ECMAScript 2017 introduced Async Functions, Shared Memory, and Atomics along with smaller language and library enhancements, bug fixes, and editorial updates. Async functions improve the asynchronous programming experience by providing syntax for promise-returning functions. Shared Memory and Atomics introduce a new memory model that allows multi-agent programs to communicate using atomic operations that ensure a well-defined execution order even on parallel CPUs. It also included new static methods on Object: Object.values, Object.entries, and Object.getOwnPropertyDescriptors.
The finished proposals page tells you what version of the specification finished proposal was added to (or will be added to, in case of ones being added to the next spec snapshot). For example:
Proposal Author Champion(s) TC39 meeting notes Expected Publication Year Array.prototype.includesDomenic Denicola Domenic Denicola
Rick WaldronNovember 2015 2016
You can view the ES2015 specification here to know what's in it.