-
Notifications
You must be signed in to change notification settings - Fork 10
/
data-json-replace.js
40 lines (26 loc) · 990 Bytes
/
data-json-replace.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
33
34
35
36
37
38
39
40
"use strict";
module.exports = function(source) {
// const buildtarget = options.buildtarget;
const buildtarget = process.env.buildtarget;
// console.log(process.env);
let processedSource = replaceThem(source);
// console.log(processedSource);
return processedSource;
};
function replaceThem(str)
{
str = str.replace(/\bisEdu_CN_1c\b/g, 'EC1');
str = str.replace(/\bisEdu_CN_2c\b/g, 'EC2');
str = str.replace(/\bisEdu_CN_3c\b/g, 'EC3');
str = str.replace(/\bisEdu_TW_A\b/g, 'ETA');
str = str.replace(/\bisEdu_TW_B\b/g, 'ETB');
str = str.replace(/\bisEdu_HK\b/g, 'EH');
str = str.replace(/\bisEdu\b/g, 'E');
str = str.replace(/\bisSimp\b/g, 'S');
str = str.replace(/\bisTrad\b/g, 'T');
str = str.replace(/\bisComp\b/g, 'Cp');
str = str.replace(/\btrue\b/g, '1');
str = str.replace(/\brel\b/g, 'r');
str = str.replace(/"r":\[\]\,/g, '');
return str;
}