Completed
Push — master ( 3886f4...6fa688 )
by Daniel
52s
created

module.exports.buildRequestQuery   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 4
c 1
b 0
f 1
nc 3
dl 0
loc 13
rs 9.2
nop 4
1
2
module.exports = {
3
    decideBlackListWhiteList: function (inDecisionValue, inEvaluatedValueForBlackList, inBlackListArray, inEvaluatedValueForWhiteList, inWhiteListArray, inValueToEvaluate) {
4
        var outResultBoolean = false;
5
        if (inDecisionValue === inEvaluatedValueForBlackList) {
6
            if (inBlackListArray.indexOf(inValueToEvaluate) === -1) {
7
                outResultBoolean = true;
8
            }
9
        } else if (inDecisionValue === inEvaluatedValueForWhiteList) {
10
            if (inWhiteListArray.indexOf(inValueToEvaluate) > -1) {
11
                outResultBoolean = true;
12
            }
13
        }
14
        return outResultBoolean;
15
    },
16
    buildRequestQuery: function (targetSharePointURL, crtListName, queryType, headerOptions) {
17
        var queryPrefix = '';
18
        if ((queryType === 'Fields') || (queryType === 'Items')) {
19
            queryPrefix = '_api/web/lists/GetByTitle(\'' + crtListName + '\')/' + queryType;
20
        } else if (queryType === 'Lists') {
21
            queryPrefix = '_api/web/' + queryType;
22
        }
23
        return {
24
            url: targetSharePointURL + queryPrefix,
25
            headers: headerOptions,
26
            json: true
27
        };
28
    }
29
}
30