-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_methods.js
More file actions
46 lines (39 loc) · 1 KB
/
test_methods.js
File metadata and controls
46 lines (39 loc) · 1 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
const path = require('path');
module.exports = {
create_test_array,
existing,
pathName,
replaceExt,
sliceExt,
regExExt,
substrExt
};
function existing(all_files) {
const final_values = [];
all_files.forEach(value => {
final_values.push(value.substr(0,value.length-4));
});
return final_values;
}
function pathName(all_files) {
return all_files.map(file => path.parse(file));
}
function replaceExt(all_files) {
return all_files.map(file => file.replace('.hdb', ''));
}
function sliceExt(all_files) {
return all_files.map(file => file.slice(0, -4))
}
function regExExt(all_files) {
return all_files.map(file => file.replace(/\.[^/.]+$/, ""))
}
function substrExt(all_files) {
return all_files.map(file => file.substr(0,file.length-4))
}
function create_test_array(arr_size) {
let test_array = [];
for (let i = 1; i <= arr_size; i++) {
test_array.push(`${i+1234567890123456}.hdb`);
}
return test_array;
}