diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-05-22 20:58:25 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-05-25 17:32:16 +0200 |
commit | e02643f32e4c97ca307f8fc5b69be79c40d70a3b (patch) | |
tree | b7f6269913cd5a0e4f26a9461a043deb0c168be0 /server/models/utils.ts | |
parent | 65fcc3119c334b75dd13bcfdebf186afdc580a8f (diff) | |
download | PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.gz PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.zst PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.zip |
Type models
Diffstat (limited to 'server/models/utils.ts')
-rw-r--r-- | server/models/utils.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/server/models/utils.ts b/server/models/utils.ts index 601811913..fd84a9239 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts | |||
@@ -14,8 +14,14 @@ function getSort (value) { | |||
14 | return [ field, direction ] | 14 | return [ field, direction ] |
15 | } | 15 | } |
16 | 16 | ||
17 | function addMethodsToModel (model: any, classMethods: Function[], instanceMethods: Function[] = []) { | ||
18 | classMethods.forEach(m => model[m.name] = m) | ||
19 | instanceMethods.forEach(m => model.prototype[m.name] = m) | ||
20 | } | ||
21 | |||
17 | // --------------------------------------------------------------------------- | 22 | // --------------------------------------------------------------------------- |
18 | 23 | ||
19 | export { | 24 | export { |
25 | addMethodsToModel, | ||
20 | getSort | 26 | getSort |
21 | } | 27 | } |