This repository has been archived by the owner on Jan 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from manifoldjs/v0.1.2
Release v0.1.2
- Loading branch information
Showing
7 changed files
with
81 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
'use strict'; | ||
|
||
function convertToBase (manifestInfo, callback) { | ||
if (!manifestInfo || !manifestInfo.content) { | ||
return callback(new Error('Manifest content is empty or not initialized.')); | ||
} | ||
|
||
return callback(undefined, manifestInfo); | ||
} | ||
|
||
function convertFromBase (manifestInfo, callback) { | ||
if (!manifestInfo || !manifestInfo.content) { | ||
return callback(new Error('Manifest content is empty or not initialized.')); | ||
} | ||
|
||
return callback(undefined, manifestInfo); | ||
} | ||
|
||
var validRootProperties = ['name', 'author', 'version', 'default_locale', 'description', 'manifest_version', 'icons', 'content_security_policy', | ||
'browser_action', 'page_action', 'background', 'commands', 'content_scripts', 'externally_connectable', 'homepage_url', | ||
'addressbar', 'options_page', 'permissions', 'optional_permissions', 'web_accessible_resources', 'minimum_edge_version', | ||
'key', '-ms-preload']; | ||
|
||
function matchFormat (manifestObj) { | ||
var lowercasePropName; | ||
|
||
for (var prop in manifestObj) { | ||
if (manifestObj.hasOwnProperty(prop)) { | ||
lowercasePropName = prop.toLowerCase(); | ||
if (validRootProperties.indexOf(lowercasePropName) === -1 && lowercasePropName.indexOf('_') <= 0) { | ||
return false; | ||
} | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
||
module.exports = { | ||
convertToBase: convertToBase, | ||
convertFromBase: convertFromBase, | ||
matchFormat: matchFormat | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters