mirror of
https://github.com/zoriya/flood.git
synced 2025-12-21 14:45:14 +00:00
Add TorrentCollection class and store torrents by hash
This commit is contained in:
21
shared/util/stringUtil.js
Normal file
21
shared/util/stringUtil.js
Normal 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;
|
||||
Reference in New Issue
Block a user