diff --git a/CHANGELOG.md b/CHANGELOG.md index a721f7598be1..d5c78c5561ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Changelog ##### Unreleased - Added a [bug](https://bugs.webkit.org/show_bug.cgi?id=236541)fix for the WebKit `Array.prototype.{ groupBy, groupByToMap }` implementation +- `core-js-compat` targets parser transforms engine names to lower case - `atob` / `btoa` marked as [fixed](https://github.com/nodejs/node/pull/41478) in NodeJS 17.5 - Added Electron 18.0 compat data mapping - Added Deno 1.20 compat data mapping diff --git a/packages/core-js-compat/targets-parser.js b/packages/core-js-compat/targets-parser.js index 87e43d0c66ef..7b2369b5d975 100644 --- a/packages/core-js-compat/targets-parser.js +++ b/packages/core-js-compat/targets-parser.js @@ -29,12 +29,17 @@ const validTargets = new Set([ 'samsung', ]); +const toLowerKeys = function (object) { + return Object.entries(object).reduce((accumulator, [key, value]) => { + accumulator[key.toLowerCase()] = value; + return accumulator; + }, {}); +}; + module.exports = function (targets) { - if (typeof targets != 'object' || Array.isArray(targets)) { - targets = { browsers: targets }; - } + const { browsers, esmodules, node, ...rest } = (typeof targets != 'object' || Array.isArray(targets)) + ? { browsers: targets } : toLowerKeys(targets); - const { browsers, esmodules, node, ...rest } = targets; const list = Object.entries(rest); if (browsers) {