Move sort operation to separate file

This commit is contained in:
Aleksandr Statciuk
2021-08-02 21:34:54 +03:00
parent 6c6fc992af
commit d9637bf158
3 changed files with 57 additions and 10 deletions

View File

@@ -15,7 +15,6 @@ async function main() {
.parsePlaylist(playlist.url)
.then(removeWrongCategories)
.then(addMissingData)
.then(sortChannels)
.then(playlist => {
if (file.read(playlist.url) !== playlist.toString()) {
log.print('updated')
@@ -65,12 +64,4 @@ async function addMissingData(playlist) {
return playlist
}
async function sortChannels(playlist) {
const channels = [...playlist.channels]
utils.sortBy(channels, ['name', 'url'])
playlist.channels = channels
return playlist
}
main()