-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.js
More file actions
27 lines (24 loc) · 1.06 KB
/
test.js
File metadata and controls
27 lines (24 loc) · 1.06 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
const value = 'static/js/\\element\\element.js';
const key = '\\element\\element.js';
const nvalue = value.replace(/\\/g, '/').replace(/\/\//g, '/');
const nkey = key.replace(/^\\/g, '').replace(/\\/g, '/');
console.log(nkey, nvalue);
const manifest = {
"\\about\\about.js": "static/js/\\about\\about.js",
"\\app\\app.js": "static/js/\\app\\app.js",
"\\element\\element.js": "static/js/\\element\\element.js",
"\\front\\front.js": "static/js/\\front\\front.js",
"\\index\\index.js": "static/js/\\index\\index.js",
"\\router\\router.js": "static/js/\\router\\router.js",
"\\test\\test.js": "static/js/\\test\\test.js",
"static\\img\\loading.gif": "static/img/loading.gif",
"static\\img\\logo.png": "static/img/logo.png",
"vendor.js": "static/js/vendor.js"
};
const normalizeManifest = {};
Object.keys(manifest).forEach(key => {
const normalizeKey = key.replace(/^\\/g, '').replace(/\\/g, '/');
const normalizeValue = manifest[key].replace(/\\/g, '/').replace(/\/\//g, '/');
normalizeManifest[normalizeKey] = normalizeValue;
});
console.log(normalizeManifest);