Completed
Push — master ( 8cba42...3886f4 )
by Daniel
53s
created

custom_functions.js ➔ MyCustomFunctions   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 34

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 34
rs 8.8571
nop 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
B custom_functions.js ➔ ... ➔ self.decideBlackListWhiteList 0 13 5
B custom_functions.js ➔ ... ➔ self.buildRequestQuery 0 18 5
1
2
var MyCustomFunctions = function () {
3
    var self = this;
4
    self.decideBlackListWhiteList = function (inDecisionValue, inEvaluatedValueForBlackList, inBlackListArray, inEvaluatedValueForWhiteList, inWhiteListArray, inValueToEvaluate) {
5
        var outResultBoolean = false;
6
        if (inDecisionValue === inEvaluatedValueForBlackList) {
7
            if (inBlackListArray.indexOf(inValueToEvaluate) === -1) {
8
                outResultBoolean = true;
9
            }
10
        } else if (inDecisionValue === inEvaluatedValueForWhiteList) {
11
            if (inWhiteListArray.indexOf(inValueToEvaluate) > -1) {
12
                outResultBoolean = true;
13
            }
14
        }
15
        return outResultBoolean;
16
    };
17
    self.buildRequestQuery = function (targetSharePointURL, crtListName, queryType, headerOptions) {
18
        var queryPrefix = '';
19
        switch (queryType) {
20
            case 'Fields':
21
            case 'Items':
22
                queryPrefix = '_api/web/lists/GetByTitle(\'' + crtListName + '\')/' + queryType;
23
                break;
24
            case 'Lists':
25
            default:
26
                queryPrefix = '_api/web/Lists';
27
                break;
28
        }
29
        return {
30
            url: targetSharePointURL + queryPrefix,
31
            headers: headerOptions,
32
            json: true
33
        };
34
    };
35
};
36
37
module.exports = MyCustomFunctions;
38