Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit 80cbf1d

Browse files
committed
Add edge extension transform
1 parent cbb8d1b commit 80cbf1d

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
'use strict';
2+
3+
function convertToBase (manifestInfo, callback) {
4+
if (!manifestInfo || !manifestInfo.content) {
5+
return callback(new Error('Manifest content is empty or not initialized.'));
6+
}
7+
8+
return callback(undefined, manifestInfo);
9+
}
10+
11+
function convertFromBase (manifestInfo, callback) {
12+
if (!manifestInfo || !manifestInfo.content) {
13+
return callback(new Error('Manifest content is empty or not initialized.'));
14+
}
15+
16+
return callback(undefined, manifestInfo);
17+
}
18+
19+
var validRootProperties = ['name', 'author', 'version', 'default_locale', 'description', 'manifest_version', 'icons', 'content_security_policy',
20+
'browser_action', 'page_action', 'background', 'commands', 'content_scripts', 'externally_connectable', 'homepage_url',
21+
'addressbar', 'options_page', 'permissions', 'optional_permissions', 'web_accessible_resources', 'minimum_edge_version',
22+
'key', '-ms-preload'];
23+
24+
function matchFormat (manifestObj) {
25+
var lowercasePropName;
26+
27+
for (var prop in manifestObj) {
28+
if (manifestObj.hasOwnProperty(prop)) {
29+
lowercasePropName = prop.toLowerCase();
30+
if (validRootProperties.indexOf(lowercasePropName) === -1 && lowercasePropName.indexOf('_') <= 0) {
31+
return false;
32+
}
33+
}
34+
}
35+
36+
return true;
37+
}
38+
39+
module.exports = {
40+
convertToBase: convertToBase,
41+
convertFromBase: convertFromBase,
42+
matchFormat: matchFormat
43+
};

0 commit comments

Comments
 (0)