aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-17 11:28:11 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-17 11:28:11 +0200
commit154898b0b7bc1af41fc5a94974e338a3590c90f3 (patch)
tree5fb90f66da7587aed53c99ac1884c7acd0c1f7ca /server/helpers
parentdf98563e2104b82b119c00a3cd83cd0dc1242d25 (diff)
downloadPeerTube-154898b0b7bc1af41fc5a94974e338a3590c90f3.tar.gz
PeerTube-154898b0b7bc1af41fc5a94974e338a3590c90f3.tar.zst
PeerTube-154898b0b7bc1af41fc5a94974e338a3590c90f3.zip
Share models between server and client
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/utils.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts
index 07c1b3f51..5b8d21f70 100644
--- a/server/helpers/utils.ts
+++ b/server/helpers/utils.ts
@@ -22,8 +22,12 @@ function createEmptyCallback () {
22 } 22 }
23} 23}
24 24
25function getFormatedObjects (objects: any[], objectsTotal: number) { 25interface FormatableToJSON {
26 const formatedObjects = [] 26 toFormatedJSON()
27}
28
29function getFormatedObjects<U, T extends FormatableToJSON> (objects: T[], objectsTotal: number) {
30 const formatedObjects: U[] = []
27 31
28 objects.forEach(function (object) { 32 objects.forEach(function (object) {
29 formatedObjects.push(object.toFormatedJSON()) 33 formatedObjects.push(object.toFormatedJSON())