You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/site/src/utils/examples.js

16 lines
452 B

export function process_example(files) {
return files
.map(file => {
const [name, type] = file.name.split('.');
return { name, type, source: file.source };
})
.sort((a, b) => {
if (a.name === 'App' && a.type === 'svelte') return -1;
if (b.name === 'App' && b.type === 'svelte') return 1;
if (a.type === b.type) return a.name < b.name ? -1 : 1;
if (a.type === 'svelte') return -1;
if (b.type === 'svelte') return 1;
});
}