Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit 62dd6cf

Browse files
committed
More readable loop on the features to enable/disable them
1 parent 653b25a commit 62dd6cf

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

index.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,21 @@ function cssnext(string, options) {
110110
Object.keys(cssnext.features).forEach(function(key) {
111111
// feature is enabled if: not force disable && (force enabled || no data yet || !supported yet)
112112
if (
113-
features[key] !== false && // feature is force disabled
113+
// feature is force disabled
114+
features[key] !== false &&
114115
(
115-
features[key] === true || // feature is forced enabled
116-
caniuseFeaturesMap[key] === undefined || // feature don't have any browsers data (yet)
117-
(caniuseFeaturesMap[key] && caniuseFeaturesMap[key][0] && !caniuse.isSupported(caniuseFeaturesMap[key][0], options.browsers)) // feature is not yet supported by the browsers scope
116+
// feature is forced enabled
117+
features[key] === true ||
118+
119+
// feature don't have any browsers data (yet)
120+
caniuseFeaturesMap[key] === undefined ||
121+
122+
// feature is not yet supported by the browsers scope
123+
(
124+
caniuseFeaturesMap[key] &&
125+
caniuseFeaturesMap[key][0] &&
126+
!caniuse.isSupported(caniuseFeaturesMap[key][0], options.browsers)
127+
)
118128
)
119129
) {
120130
postcss.use(cssnext.features[key](typeof features[key] === "object" ? features[key] : undefined))

0 commit comments

Comments
 (0)