forked from nullstack/nullstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient-loader.js
More file actions
27 lines (27 loc) · 752 Bytes
/
client-loader.js
File metadata and controls
27 lines (27 loc) · 752 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
module.exports = function(source) {
source = source.replace(/^.*database\.url.*$/mg, "");
source = source.replace(/^.*database\.name.*$/mg, "");
if(source.indexOf('@server') > 0) {
blocks = source.split("\r\n\r\n");
source = blocks.map((block) => {
if(block.indexOf('@server') > 0) {
let lines = block.split("\r\n");
lines.splice(2, lines.length - 3);
return lines.join("\r\n");
} else {
return block;
}
}).join("\r\n\r\n");
}
if(source.indexOf('//server') > 0) {
lines = source.split("\n");
source = lines.map((block) => {
if(block.indexOf('//server') > 0) {
return "";
} else {
return block;
}
}).join("\n");
}
return source;
}