@stackfactor/client-api 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -2
- package/lib/axios.js +1 -1
- package/lib/users.js +1 -1
- package/lib/utils.js +21 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ const config = require("./lib/config");
|
|
|
4
4
|
const constants = require("./lib/constants");
|
|
5
5
|
const integration = require("./lib/integration");
|
|
6
6
|
const integrationsConfiguration = require("./lib/integrationConfiguration");
|
|
7
|
-
const
|
|
7
|
+
const departmentTraingPlans = require("./lib/departmentTrainingPlans");
|
|
8
8
|
const groups = require("./lib/groups");
|
|
9
9
|
const role = require("./lib/role");
|
|
10
10
|
const roleTemplate = require("./lib/roleTemplate");
|
|
@@ -29,7 +29,7 @@ module.exports = {
|
|
|
29
29
|
DOCUMENT_VERSION: constants.DOCUMENT_VERSION,
|
|
30
30
|
integration,
|
|
31
31
|
integrationsConfiguration,
|
|
32
|
-
|
|
32
|
+
departmentTraingPlans,
|
|
33
33
|
groups,
|
|
34
34
|
RESONSE_TYPE: constants.RESONSE_TYPE,
|
|
35
35
|
role,
|
package/lib/axios.js
CHANGED
package/lib/users.js
CHANGED
package/lib/utils.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const utils = {
|
|
2
2
|
/**
|
|
3
3
|
* Convert object to array
|
|
4
|
+
* @param {Object} data
|
|
5
|
+
* @returns {Array}
|
|
4
6
|
*/
|
|
5
7
|
objectToArray: (data) => {
|
|
6
8
|
if (typeof data === "object") {
|
|
@@ -10,6 +12,7 @@ const utils = {
|
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Returns the backend base API URL
|
|
15
|
+
* @returns {String}
|
|
13
16
|
*/
|
|
14
17
|
getBaseUrl: () => {
|
|
15
18
|
if (!process.env.NODE_ENV || process.env.NODE_ENV === "production") {
|
|
@@ -18,6 +21,24 @@ const utils = {
|
|
|
18
21
|
return "http://localhost:3100/";
|
|
19
22
|
}
|
|
20
23
|
},
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Remove null properties
|
|
27
|
+
* @param {Object} object
|
|
28
|
+
* @returns {Object}
|
|
29
|
+
*/
|
|
30
|
+
removeNullProperties: (object) => {
|
|
31
|
+
Object.keys(object).forEach((key) => {
|
|
32
|
+
let value = object[key.toString()];
|
|
33
|
+
let hasProperties = value && Object.keys(value).length > 0;
|
|
34
|
+
if (value === null) {
|
|
35
|
+
delete object[key.toString()];
|
|
36
|
+
} else if (typeof value !== "string" && hasProperties) {
|
|
37
|
+
removeNullProperties(value);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return object;
|
|
41
|
+
},
|
|
21
42
|
};
|
|
22
43
|
|
|
23
44
|
module.exports = utils;
|