Skip to content

Commit

Permalink
[core-js-compat] Filter available modules without using an intermedia…
Browse files Browse the repository at this point in the history
…te set
  • Loading branch information
nicolo-ribaudo committed Jul 4, 2019
1 parent 1508eb0 commit c9038b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/core-js-compat/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { coerce, lt, lte } = require('semver');
const browserslist = require('browserslist');
const data = require('./data');
const getModulesListForTargetVersion = require('./get-modules-list-for-target-version');
const intersection = require('core-js-pure/features/set/intersection');
const has = Function.call.bind({}.hasOwnProperty);

const mapping = new Map([
Expand Down Expand Up @@ -86,7 +85,8 @@ function compat({ targets, filter, version }) {
else if (typeof filter == 'string') modules = modules.filter(it => it.startsWith(filter));

if (version) {
modules = [...intersection(new Set(getModulesListForTargetVersion(version)), new Set(modules))];
const availableModules = new Set(getModulesListForTargetVersion(version));
modules = modules.filter(name => availableModules.has(name));
}

modules.forEach(key => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"main": "index.js",
"dependencies": {
"browserslist": "^4.6.3",
"core-js-pure": "3.1.4",
"semver": "^6.1.3"
},
"devDependencies": {
"core-js-pure": "3.1.4",
"detective": "^5.2.0",
"electron-to-chromium": "^1.3.180",
"glob": "^7.1.4"
Expand Down

0 comments on commit c9038b3

Please sign in to comment.