14 lines
379 B
JavaScript
14 lines
379 B
JavaScript
|
export function sortFiles(challengeFiles) {
|
||
|
const xs = Object.values(challengeFiles);
|
||
|
// TODO: refactor this to use an ext array ['html', 'js', 'css'] and loop over
|
||
|
// that.
|
||
|
xs.sort((a, b) => {
|
||
|
if (a.ext === 'html') return -1;
|
||
|
if (b.ext === 'html') return 1;
|
||
|
if (a.ext === 'js') return -1;
|
||
|
if (b.ext === 'js') return 1;
|
||
|
return 0;
|
||
|
});
|
||
|
return xs;
|
||
|
}
|