Add TorrentCollection class and store torrents by hash

This commit is contained in:
John Furrow
2016-02-06 18:36:28 -08:00
parent 4dd8a69e84
commit 81d799b598
16 changed files with 145 additions and 65 deletions

View File

@@ -1,4 +1,8 @@
export function sortTorrents(torrents, sortBy) {
export function sortTorrents(torrentsHash, sortBy) {
let torrents = Object.keys(torrentsHash).map((hash) => {
return {hash, ...torrentsHash[hash]};
});
if (torrents.length) {
let direction = sortBy.direction;
let property = sortBy.property;