diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-17 11:28:11 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-17 11:28:11 +0200 |
commit | 154898b0b7bc1af41fc5a94974e338a3590c90f3 (patch) | |
tree | 5fb90f66da7587aed53c99ac1884c7acd0c1f7ca /server/helpers/utils.ts | |
parent | df98563e2104b82b119c00a3cd83cd0dc1242d25 (diff) | |
download | PeerTube-154898b0b7bc1af41fc5a94974e338a3590c90f3.tar.gz PeerTube-154898b0b7bc1af41fc5a94974e338a3590c90f3.tar.zst PeerTube-154898b0b7bc1af41fc5a94974e338a3590c90f3.zip |
Share models between server and client
Diffstat (limited to 'server/helpers/utils.ts')
-rw-r--r-- | server/helpers/utils.ts | 8 |
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 | ||
25 | function getFormatedObjects (objects: any[], objectsTotal: number) { | 25 | interface FormatableToJSON { |
26 | const formatedObjects = [] | 26 | toFormatedJSON() |
27 | } | ||
28 | |||
29 | function 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()) |