From c2c96995a16513fac3ef4f14d62ca752cace0f24 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Thu, 2 Mar 2017 22:33:03 +0100 Subject: [PATCH] Add comments --- experimental/babel-preset-env/scripts/build-data.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/experimental/babel-preset-env/scripts/build-data.js b/experimental/babel-preset-env/scripts/build-data.js index a3f52b987e..f7958ed699 100644 --- a/experimental/babel-preset-env/scripts/build-data.js +++ b/experimental/babel-preset-env/scripts/build-data.js @@ -56,10 +56,16 @@ const invertedEqualsEnv = Object.keys(envs) .reduce((a, b) => { const checkEnv = envMap[envs[b].equals] || envs[b].equals; environments.some((env) => { + // go through all environment names to find the the current one + // and try to get the version as integer const version = parseInt(checkEnv.replace(env, ""), 10); if (!isNaN(version)) { Object.keys(envs).forEach((equals) => { + // Go through all envs from compat-table and get int version const equalsVersion = parseInt(equals.replace(env, ""), 10); + // If the current version is smaller than the version that was mentioned + // in `equals` we can add an entry, as older versions should include features + // that newer ones have if (!isNaN(equalsVersion) && equalsVersion <= version) { if (!a[equals]) a[equals] = []; a[equals].push(b);