Skip to content
This repository has been archived by the owner on May 11, 2018. It is now read-only.

Commit

Permalink
Version can be float and correctly lookup envMap
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Mar 3, 2017
1 parent 6549565 commit fc040dd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
36 changes: 18 additions & 18 deletions data/built-ins.json
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@
"firefox": 25,
"safari": 8,
"node": 4,
"ios": 9,
"ios": 8,
"opera": 32
},
"es6.array.find-index": {
Expand All @@ -447,7 +447,7 @@
"firefox": 25,
"safari": 8,
"node": 4,
"ios": 9,
"ios": 8,
"opera": 32
},
"es6.array.fill": {
Expand All @@ -456,7 +456,7 @@
"firefox": 31,
"safari": 8,
"node": 4,
"ios": 9,
"ios": 8,
"opera": 32
},
"es6.array.iterator": {
Expand All @@ -466,7 +466,7 @@
"safari": 8,
"node": 0.12,
"android": 5.1,
"ios": 9,
"ios": 8,
"opera": 25
},
"es6.number.is-finite": {
Expand Down Expand Up @@ -544,7 +544,7 @@
"safari": 8,
"node": 0.12,
"android": 5.1,
"ios": 9,
"ios": 8,
"opera": 25
},
"es6.math.asinh": {
Expand All @@ -554,7 +554,7 @@
"safari": 8,
"node": 0.12,
"android": 5.1,
"ios": 9,
"ios": 8,
"opera": 25
},
"es6.math.atanh": {
Expand All @@ -564,7 +564,7 @@
"safari": 8,
"node": 0.12,
"android": 5.1,
"ios": 9,
"ios": 8,
"opera": 25
},
"es6.math.cbrt": {
Expand All @@ -574,7 +574,7 @@
"safari": 8,
"node": 0.12,
"android": 5.1,
"ios": 9,
"ios": 8,
"opera": 25
},
"es6.math.clz32": {
Expand All @@ -594,7 +594,7 @@
"safari": 8,
"node": 0.12,
"android": 5.1,
"ios": 9,
"ios": 8,
"opera": 25
},
"es6.math.expm1": {
Expand All @@ -604,7 +604,7 @@
"safari": 8,
"node": 0.12,
"android": 5.1,
"ios": 9,
"ios": 8,
"opera": 25
},
"es6.math.fround": {
Expand All @@ -614,7 +614,7 @@
"safari": 8,
"node": 0.12,
"android": 5.1,
"ios": 9,
"ios": 8,
"opera": 25
},
"es6.math.hypot": {
Expand All @@ -624,7 +624,7 @@
"safari": 8,
"node": 0.12,
"android": 5.1,
"ios": 9,
"ios": 8,
"opera": 25
},
"es6.math.imul": {
Expand All @@ -644,7 +644,7 @@
"safari": 8,
"node": 0.12,
"android": 5.1,
"ios": 9,
"ios": 8,
"opera": 25
},
"es6.math.log10": {
Expand All @@ -654,7 +654,7 @@
"safari": 8,
"node": 0.12,
"android": 5.1,
"ios": 9,
"ios": 8,
"opera": 25
},
"es6.math.log2": {
Expand All @@ -664,7 +664,7 @@
"safari": 8,
"node": 0.12,
"android": 5.1,
"ios": 9,
"ios": 8,
"opera": 25
},
"es6.math.sign": {
Expand All @@ -684,7 +684,7 @@
"safari": 8,
"node": 0.12,
"android": 5.1,
"ios": 9,
"ios": 8,
"opera": 25
},
"es6.math.tanh": {
Expand All @@ -694,7 +694,7 @@
"safari": 8,
"node": 0.12,
"android": 5.1,
"ios": 9,
"ios": 8,
"opera": 25
},
"es6.math.trunc": {
Expand All @@ -704,7 +704,7 @@
"safari": 8,
"node": 0.12,
"android": 5.1,
"ios": 9,
"ios": 8,
"opera": 25
},
"es7.array.includes": {
Expand Down
2 changes: 1 addition & 1 deletion data/plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"firefox": 34,
"safari": 8,
"node": 4,
"ios": 9,
"ios": 8,
"opera": 31
},
"check-es2015-constants": {
Expand Down
9 changes: 4 additions & 5 deletions scripts/build-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ const invertedEqualsEnv = Object.keys(envs)
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);
const version = parseFloat(checkEnv.replace(env, ""));
if (!isNaN(version)) {
Object.keys(envs).forEach((equals) => {
equals = envMap[equals] || equals;
// Go through all envs from compat-table and get int version
const equalsVersion = parseInt(equals.replace(env, ""), 10);
const equalsVersion = parseFloat(equals.replace(env, ""));
// 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
Expand All @@ -78,8 +79,6 @@ const invertedEqualsEnv = Object.keys(envs)
return a;
}, {});

invertedEqualsEnv.safari8 = ["ios9"];

const compatibilityTests = flattenDeep([
es6Data,
es6PlusData,
Expand Down Expand Up @@ -141,7 +140,7 @@ const getLowestImplementedVersion = ({ features }, env) => {
.filter((test) => tests[i].res[test] === true || tests[i].res[test] === "strict")
// normalize some keys
.map((test) => envMap[test] || test)
.filter((test) => !isNaN(parseInt(test.replace(env, ""))))
.filter((test) => !isNaN(parseFloat(test.replace(env, ""))))
.shift();
});

Expand Down

0 comments on commit fc040dd

Please sign in to comment.