Skip to content

Commit 9667c59

Browse files
committed
Fixes ordering of selectors
1 parent 3fc29ab commit 9667c59

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

readme.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@ analyze('foo {}')
182182
// }
183183
```
184184

185-
## License
185+
## Related projects
186186

187-
MIT © Bart Veneman
187+
- [Wallace](https://github.com/bartveneman/wallace-cli) - CLI tool for
188+
@projectwallace/css-analyzer
189+
- [CSS Analyzer Diff](https://github.com/bartveneman/css-analyzer-diff) -
190+
Calculates the diff between two sets of CSS analysis
191+
- [Gromit](https://github.com/bartveneman/gromit-cli) - A test framework to assert
192+
that CSS doesn't exceeds certain thresholds
193+
- [Color Sorter](https://github.com/bartveneman/color-sorter) - Sort CSS colors
194+
by hue, saturation, lightness and opacity

src/analyzer/selectors/identifiers.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ module.exports = selectors => {
1616
.reduce((prev, curr) => prev + curr, 0)
1717
const average = totalIdentifiers / totalSelectors
1818

19-
const top = function (count) {
20-
const sorter = function (a, b) {
21-
return a.identifiers > b.identifiers ? -1 : 1
19+
const top = (count) => {
20+
const sorter = (a, b) => {
21+
if (a.identifiers === b.identifiers) {
22+
return a.selector.localeCompare(b.selector)
23+
}
24+
25+
return b.identifiers - a.identifiers
2226
}
2327

2428
return identifiersPerSelector

0 commit comments

Comments
 (0)