forked from piceaTech/node-gitlab-2-github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
31 lines (26 loc) · 881 Bytes
/
utils.js
File metadata and controls
31 lines (26 loc) · 881 Bytes
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
import * as settings from './settings';
const sleep = milliseconds => {
return new Promise(resolve => setTimeout(resolve, milliseconds));
};
/**
* Generate regular expression which finds userid and cross-project issue references
* from usermap and projectmap
*/
const generateUserProjectRegex = () => {
let reString = '';
if (settings.usermap !== null && Object.keys(settings.usermap).length > 0) {
reString = '@' + Object.keys(settings.usermap).join('|@');
}
if (
settings.projectmap !== null &&
Object.keys(settings.projectmap).length > 0
) {
if (reString.length > 0) {
reString += '|';
}
reString += Object.keys(settings.projectmap).join('#|') + '#';
}
return new RegExp(reString, 'g');
};
// ----------------------------------------------------------------------------
module.exports = { sleep, generateUserProjectRegex };