Skip to content
Permalink
Browse files
refactor: use property shorthand notation (#116)
Applied `lebab --replace src --transform obj-shorthand` to the code.
  • Loading branch information
raphinesse committed Dec 15, 2019
1 parent e815a29 commit 95010ef0a034bcfd683951a247ccedf74418e23e
Showing 5 changed files with 27 additions and 35 deletions.
@@ -273,7 +273,7 @@ function generate_config_xml_munge (config, config_changes, type) {
const stringified = (new et.ElementTree(xml)).write({ xml_declaration: false });
// 2. add into munge
if (change.mode) {
mungeutil.deep_add(munge, change.file, change.target, { xml: stringified, count: 1, mode: change.mode, id: id });
mungeutil.deep_add(munge, change.file, change.target, { xml: stringified, count: 1, mode: change.mode, id });
} else {
mungeutil.deep_add(munge, change.target, change.parent, { xml: stringified, count: 1, after: change.after });
}
@@ -385,11 +385,11 @@ PlatformMunger.prototype._is_conflicting = function (editchanges, config_munge,
});

return {
conflictFound: conflictFound,
conflictingPlugin: conflictingPlugin,
conflictingMunge: conflictingMunge,
configxmlMunge: configxmlMunge,
conflictWithConfigxml: conflictWithConfigxml
conflictFound,
conflictingPlugin,
conflictingMunge,
configxmlMunge,
conflictWithConfigxml
};
};

@@ -303,7 +303,7 @@ ConfigParser.prototype = {

if (platform) { // platform specific resources
fileResources = this.doc.findall('./platform[@name="' + platform + '"]/resource-file').map(tag => ({
platform: platform,
platform,
src: tag.attrib.src,
target: tag.attrib.target,
versions: tag.attrib.versions,
@@ -511,13 +511,13 @@ ConfigParser.prototype = {

return {
origin: access.attrib.origin,
minimum_tls_version: minimum_tls_version,
requires_forward_secrecy: requires_forward_secrecy,
requires_certificate_transparency: requires_certificate_transparency,
allows_arbitrary_loads_in_web_content: allows_arbitrary_loads_in_web_content,
allows_arbitrary_loads_in_media: allows_arbitrary_loads_in_media,
allows_arbitrary_loads_for_media: allows_arbitrary_loads_for_media,
allows_local_networking: allows_local_networking
minimum_tls_version,
requires_forward_secrecy,
requires_certificate_transparency,
allows_arbitrary_loads_in_web_content,
allows_arbitrary_loads_in_media,
allows_arbitrary_loads_for_media,
allows_local_networking
};
});
},
@@ -531,9 +531,9 @@ ConfigParser.prototype = {

return {
href: allow_navigation.attrib.href,
minimum_tls_version: minimum_tls_version,
requires_forward_secrecy: requires_forward_secrecy,
requires_certificate_transparency: requires_certificate_transparency
minimum_tls_version,
requires_forward_secrecy,
requires_certificate_transparency
};
});
},
@@ -311,7 +311,7 @@ function mergeAndUpdateDir (sourceDirs, targetDir, options, log) {
* Creates a dictionary map of all files and directories under a path.
*/
function mapDirectory (rootDir, subDir, include, exclude) {
const dirMap = { '': { subDir: subDir, stats: fs.statSync(path.join(rootDir, subDir)) } };
const dirMap = { '': { subDir, stats: fs.statSync(path.join(rootDir, subDir)) } };
mapSubdirectory(rootDir, subDir, '', include, exclude, dirMap);
return dirMap;

@@ -333,13 +333,13 @@ function mapDirectory (rootDir, subDir, include, exclude) {
// match an include glob.
if (mapSubdirectory(rootDir, subDir, relativePath, include, exclude, dirMap) ||
matchGlobArray(relativePath, include)) {
dirMap[relativePath] = { subDir: subDir, stats: stats };
dirMap[relativePath] = { subDir, stats };
itemMapped = true;
}
} else if (stats.isFile()) {
// Files are included only if they match an include glob.
if (matchGlobArray(relativePath, include)) {
dirMap[relativePath] = { subDir: subDir, stats: stats };
dirMap[relativePath] = { subDir, stats };
itemMapped = true;
}
}
@@ -394,7 +394,7 @@ function mergePathMaps (sourceMaps, targetMap, targetDir) {
}

module.exports = {
updatePath: updatePath,
updatePaths: updatePaths,
mergeAndUpdateDir: mergeAndUpdateDir
updatePath,
updatePaths,
mergeAndUpdateDir
};
@@ -142,7 +142,7 @@ PlatformJson.prototype.removePluginMetadata = function (pluginInfo) {
};

PlatformJson.prototype.addInstalledPluginToPrepareQueue = function (pluginDirName, vars, is_top_level, force) {
this.root.prepare_queue.installed.push({ plugin: pluginDirName, vars: vars, topLevel: is_top_level, force: force });
this.root.prepare_queue.installed.push({ plugin: pluginDirName, vars, topLevel: is_top_level, force });
};

PlatformJson.prototype.addUninstalledPluginToPrepareQueue = function (pluginId, is_top_level) {
@@ -72,11 +72,7 @@ function PluginInfo (dirname) {
throw new Error(msg);
}

const asset = {
itemType: 'asset',
src: src,
target: target
};
const asset = { itemType: 'asset', src, target };
return asset;
}

@@ -279,11 +275,7 @@ function PluginInfo (dirname) {
return Object.assign({}, acc, { [val.name]: val });
}, {});
}
return {
declarations: declarations,
sources: sources,
libraries: libraries
};
return { declarations, sources, libraries };
});
return podSpecs;
}
@@ -372,7 +364,7 @@ function PluginInfo (dirname) {
parent: el.attrib.parent,
custom: isStrTrue(el.attrib.custom),
embed: isStrTrue(el.attrib.embed),
src: src,
src,
spec: el.attrib.spec,
weak: isStrTrue(el.attrib.weak),
versions: el.attrib.versions,

0 comments on commit 95010ef

Please sign in to comment.