forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.js
32 lines (28 loc) · 769 Bytes
/
utils.js
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
const path = require('path');
require('dotenv').config({ path: path.resolve(__dirname, '../.env') });
exports.dasherize = function dasherize(name) {
return ('' + name)
.toLowerCase()
.replace(/\s/g, '-')
.replace(/[^a-z0-9\-\.]/gi, '')
.replace(/\:/g, '');
};
const supportedLangs = [
'arabic',
'chinese',
'english',
'portuguese',
'russian',
'spanish'
];
exports.testedLangs = function testedLangs() {
if (process.env.TEST_CHALLENGES_FOR_LANGS) {
const filterLangs = process.env.TEST_CHALLENGES_FOR_LANGS.split(',').map(
lang => lang.trim().toLowerCase()
);
return supportedLangs.filter(lang => filterLangs.includes(lang));
} else {
return [...supportedLangs];
}
};
exports.supportedLangs = supportedLangs;