c0132c5b4e21c650870a7a3893dae250a4952e5b3f7cb6e48efcfe1e146df09dfdb14cc2ba6b4d7776c8a116e376ab5be2e75ac50e1c8f59d7deca138469da 529 B

1234567891011121314151617181920212223
  1. var naturalCompare = require('../../utils/natural-compare');
  2. function naturalSorter(scope1, scope2) {
  3. return naturalCompare(scope1[1], scope2[1]);
  4. }
  5. function standardSorter(scope1, scope2) {
  6. return scope1[1] > scope2[1] ? 1 : -1;
  7. }
  8. function sortSelectors(selectors, method) {
  9. switch (method) {
  10. case 'natural':
  11. return selectors.sort(naturalSorter);
  12. case 'standard':
  13. return selectors.sort(standardSorter);
  14. case 'none':
  15. case false:
  16. return selectors;
  17. }
  18. }
  19. module.exports = sortSelectors;