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 | 4x 232x 232x 232x 211x 211x 211x 21x 4x | /* eslint-disable complexity */ 'use strict'; const testExpression = /(^|\/|\\)(?:((?:u[0-9a-f]{4,6},?)+)-)(.+)\.svg$/i; function fileSorter(fileA, fileB) { const hasUnicodeA = testExpression.test(fileA); const hasUnicodeB = testExpression.test(fileB); if (hasUnicodeA == hasUnicodeB) { // just compare alphabetically const fileA_ = fileA.substr(0, fileA.lastIndexOf('.')); const fileB_ = fileB.substr(0, fileB.lastIndexOf('.')); return fileA_ < fileB_ ? -1 : 1; } else { // map true to 0, because we want it to be first return (hasUnicodeA ? 0 : 1) - (hasUnicodeB ? 0 : 1); } } module.exports = fileSorter; |