postcss-reduce-transforms 5.0.2 → 5.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -181,15 +181,7 @@ function translate3d(node, values) {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
const reducers =
|
|
185
|
-
matrix3d,
|
|
186
|
-
rotate3d,
|
|
187
|
-
rotateZ,
|
|
188
|
-
scale,
|
|
189
|
-
scale3d,
|
|
190
|
-
translate,
|
|
191
|
-
translate3d
|
|
192
|
-
};
|
|
184
|
+
const reducers = new Map([['matrix3d', matrix3d], ['rotate3d', rotate3d], ['rotateZ', rotateZ], ['scale', scale], ['scale3d', scale3d], ['translate', translate], ['translate3d', translate3d]]);
|
|
193
185
|
|
|
194
186
|
function normalizeReducerName(name) {
|
|
195
187
|
const lowerCasedName = name.toLowerCase();
|
|
@@ -202,15 +194,13 @@ function normalizeReducerName(name) {
|
|
|
202
194
|
}
|
|
203
195
|
|
|
204
196
|
function reduce(node) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
value
|
|
209
|
-
} = node;
|
|
210
|
-
const normalizedReducerName = normalizeReducerName(value);
|
|
197
|
+
if (node.type === 'function') {
|
|
198
|
+
const normalizedReducerName = normalizeReducerName(node.value);
|
|
199
|
+
const reducer = reducers.get(normalizedReducerName);
|
|
211
200
|
|
|
212
|
-
|
|
213
|
-
|
|
201
|
+
if (reducer !== undefined) {
|
|
202
|
+
reducer(node, node.nodes.reduce(getValues, []));
|
|
203
|
+
}
|
|
214
204
|
}
|
|
215
205
|
|
|
216
206
|
return false;
|