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

21
shared/util/stringUtil.js Normal file
View File

@@ -0,0 +1,21 @@
'use strict';
let stringUtil = {
capitalize: function (string) {
return string.charAt(0).toUpperCase() + string.slice(1);
},
pluralize: function (string, count) {
if (count !== 1) {
if (string.charAt(string.length - 1) === 'y') {
return `${string.substring(0, string.length - 1)}ies`;
} else {
return `${string}s`;
}
}
return string;
}
}
module.exports = stringUtil;