-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathutil.js
More file actions
60 lines (43 loc) · 1.25 KB
/
Copy pathutil.js
File metadata and controls
60 lines (43 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.convertToQueryParams = convertToQueryParams;
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function convertToQueryParams(o) {
delete o['mpid'];
delete o['inputFile'];
var params = _lodash2.default.map(o, function (value, attr) {
if (attr == 'appID') attr = 'app_id';
if (attr == 'appKey') attr = 'app_key';
var returnValue = void 0;
switch (attr) {
case 'appID':
returnValue = 'app_id=' + value;
break;
case 'appKey':
returnValue = 'app_key=' + value;
break;
case 'storeId':
case 'alsoSoldAt':
case 'brandId':
case 'categoryId':
case 'facetBy':
if (_lodash2.default.isArray(value)) {
var x = _lodash2.default.map(value, function (value) {
return attr + '=' + value;
});
returnValue = x.join('&');
} else {
returnValue = attr + '=' + value;
}
break;
default:
returnValue = attr + '=' + value;
}
return returnValue;
});
return params.join('&');
}