Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 8x 8x 101x 123x 97x 97x 26x 5x 5x 21x 19x 19x 19x 2x 77x 8x | const { mapObject, mapObjectValues } = require('./utils/helpers'); const { getClass, normalizePseudoElements, isNestedStyles, isAtRule, isPseudoSelector } = require('./utils/styles'); function getClassValues(styles, { atRules = [], pseudoSelectors = [] } = {}) { return mapObject(styles, ([name, value]) => { if (!isNestedStyles(value)) { const newValue = getClass({ name, value, atRules, pseudoSelectors }); return [name, newValue]; } if (isAtRule(name)) { const newValue = getClassValues(value, { atRules: [...atRules, name], pseudoSelectors }); return [name, newValue]; } if (isPseudoSelector(name)) { const normalizedName = normalizePseudoElements(name); const newValue = getClassValues(value, { pseudoSelectors: [...pseudoSelectors, normalizedName], atRules }); return [normalizedName, newValue]; } throw new Error( `Invalid key ${name}. Object keys must be at-rules or pseudo selectors` ); }); } function generateClasses(obj) { return mapObjectValues(obj, value => getClassValues(value)); } module.exports = generateClasses; |