aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/utils.js')
-rw-r--r--server/helpers/utils.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/server/helpers/utils.js b/server/helpers/utils.js
index 7e0c9823c..9f4b14582 100644
--- a/server/helpers/utils.js
+++ b/server/helpers/utils.js
@@ -8,7 +8,8 @@ const utils = {
8 badRequest, 8 badRequest,
9 cleanForExit, 9 cleanForExit,
10 generateRandomString, 10 generateRandomString,
11 isTestInstance 11 isTestInstance,
12 getFormatedObjects
12} 13}
13 14
14function badRequest (req, res, next) { 15function badRequest (req, res, next) {
@@ -32,6 +33,19 @@ function isTestInstance () {
32 return (process.env.NODE_ENV === 'test') 33 return (process.env.NODE_ENV === 'test')
33} 34}
34 35
36function getFormatedObjects (objects, objectsTotal) {
37 const formatedObjects = []
38
39 objects.forEach(function (object) {
40 formatedObjects.push(object.toFormatedJSON())
41 })
42
43 return {
44 total: objectsTotal,
45 data: formatedObjects
46 }
47}
48
35// --------------------------------------------------------------------------- 49// ---------------------------------------------------------------------------
36 50
37module.exports = utils 51module.exports = utils