Skip to content

Commit

Permalink
Create 54-repetition.js
Browse files Browse the repository at this point in the history
Rel #54
  • Loading branch information
LeaVerou committed Nov 29, 2020
1 parent 05c4b2a commit c077d06
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions js/54-repetition.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export default function compute() {

let ret = {total: 0};

let unique = new Set();

walkDeclarations(ast, ({property, value}) => {
if (!property.startsWith("--")) { // Custom props are case sensitive
property = property.toLowerCase();
}

ret.total++;
unique.add(`${property}: ${value}`);
});

ret.unique = unique.size;
ret.ratio = ret.unique / ret.total;

return ret;

}

0 comments on commit c077d06

Please sign in to comment.