Skip to content

Commit

Permalink
refactor: transform object shorthand
Browse files Browse the repository at this point in the history
  • Loading branch information
erisu committed Dec 17, 2019
1 parent 3b54a73 commit ea85f74
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions bin/templates/scripts/cordova/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function Api (platform, platformRootDir, events) {
defaultConfigXml: path.join(this.root, 'cordova/defaults.xml'),
pbxproj: path.join(this.root, xcodeProjDir, 'project.pbxproj'),
xcodeProjDir: path.join(this.root, xcodeProjDir),
xcodeCordovaProj: xcodeCordovaProj
xcodeCordovaProj
};
}

Expand Down Expand Up @@ -348,7 +348,7 @@ Api.prototype.addPodSpecs = function (plugin, podSpecs, frameworkPods) {
if (obj.declarations[key] === 'true') {
const declaration = Podfile.proofDeclaration(key);
const podJson = {
declaration: declaration
declaration
};
const val = podsjsonFile.getDeclaration(declaration);
if (val) {
Expand Down Expand Up @@ -462,7 +462,7 @@ Api.prototype.removePodSpecs = function (plugin, podSpecs, frameworkPods) {
if (obj.declarations[key] === 'true') {
const declaration = Podfile.proofDeclaration(key);
const podJson = {
declaration: declaration
declaration
};
const val = podsjsonFile.getDeclaration(declaration);
if (val) {
Expand Down
12 changes: 6 additions & 6 deletions bin/templates/scripts/cordova/lib/BridgingHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ BridgingHeader.prototype.__parseForBridgingHeader = text => {
case 'comment':
if (i + 1 < text.length && text[i] === '*' && text[i + 1] === '/') {
i += 2;
list.push({ type: type, code: text.slice(start, i) });
list.push({ type, code: text.slice(start, i) });
type = 'code';
start = i;
} else {
Expand All @@ -77,7 +77,7 @@ BridgingHeader.prototype.__parseForBridgingHeader = text => {
case 'line-comment':
if (i < text.length && text[i] === '\n') {
i += 1;
list.push({ type: type, code: text.slice(start, i) });
list.push({ type, code: text.slice(start, i) });
type = 'code';
start = i;
} else {
Expand All @@ -88,19 +88,19 @@ BridgingHeader.prototype.__parseForBridgingHeader = text => {
default:
if (i + 1 < text.length && text[i] === '/' && text[i + 1] === '*') { // comment
if (start < i) {
list.push({ type: type, code: text.slice(start, i) });
list.push({ type, code: text.slice(start, i) });
}
type = 'comment';
start = i;
} else if (i + 1 < text.length && text[i] === '/' && text[i + 1] === '/') { // line comment
if (start < i) {
list.push({ type: type, code: text.slice(start, i) });
list.push({ type, code: text.slice(start, i) });
}
type = 'line-comment';
start = i;
} else if (i < text.length && text[i] === '\n') {
i += 1;
list.push({ type: type, code: text.slice(start, i) });
list.push({ type, code: text.slice(start, i) });
start = i;
} else {
i += 1;
Expand All @@ -109,7 +109,7 @@ BridgingHeader.prototype.__parseForBridgingHeader = text => {
}
}
if (start < i) {
list.push({ type: type, code: text.slice(start, i) });
list.push({ type, code: text.slice(start, i) });
}
return list;
};
Expand Down
4 changes: 2 additions & 2 deletions bin/templates/scripts/cordova/lib/Podfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ Podfile.prototype.addSpec = function (name, spec) {

if (typeof spec === 'string') {
if (spec.startsWith(':')) {
spec = { name: name, options: spec };
spec = { name, options: spec };
} else {
spec = { name: name, spec: spec };
spec = { name, spec };
}
}

Expand Down
2 changes: 1 addition & 1 deletion bin/templates/scripts/cordova/lib/check_reqs.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function checkTool (tool, minVersion, message, toolFriendlyName) {
return versions.get_tool_version(tool).then(version => {
version = version.trim();
return versions.compareVersions(version, minVersion) >= 0
? Q.resolve({ version: version })
? Q.resolve({ version })
: Q.reject('Cordova needs ' + toolFriendlyName + ' version ' + minVersion +
' or greater, you have version ' + version + '. ' + (message || ''));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const handlers = {
events.emit('verbose', '"Embed Frameworks" Build Phase (Embedded Binaries) does not exist, creating it.');
project.xcode.addBuildPhase([], 'PBXCopyFilesBuildPhase', 'Embed Frameworks', null, 'frameworks');
}
const opt = { customFramework: true, embed: embed, link: link, sign: true };
const opt = { customFramework: true, embed, link, sign: true };
events.emit('verbose', util.format('Adding custom framework to project... %s -> %s', src, JSON.stringify(opt)));
project.xcode.addFramework(project_relative, opt);
events.emit('verbose', util.format('Custom framework added to project. %s -> %s', src, JSON.stringify(opt)));
Expand Down
8 changes: 4 additions & 4 deletions bin/templates/scripts/cordova/lib/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,10 @@ function mapLaunchStoryboardContents (splashScreens, launchStoryboardImagesDir)
sizes.forEach(width => {
sizes.forEach(height => {
const item = {
idiom: idiom,
scale: scale,
width: width,
height: height
idiom,
scale,
width,
height
};

/* examples of the search pattern:
Expand Down
4 changes: 2 additions & 2 deletions bin/templates/scripts/cordova/lib/projectFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function parseProjectFile (locations) {
getUninstaller: function (name) {
return pluginHandlers.getUninstaller(name);
},
frameworks: frameworks
frameworks
};
return cachedProjectFiles[project_dir];
}
Expand All @@ -97,7 +97,7 @@ function purgeProjectFileCache (project_dir) {

module.exports = {
parse: parseProjectFile,
purgeProjectFileCache: purgeProjectFileCache
purgeProjectFileCache
};

xcode.project.prototype.pbxEmbedFrameworksBuildPhaseObj = function (target) {
Expand Down
4 changes: 2 additions & 2 deletions tests/spec/unit/BridgingHeader.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('unit tests for BridgingHeader module', () => {
existsSyncSpy.and.returnValue(true);
readFileSyncSpy.and.callFake((read_path, charset) => bridgingHeaderFileContent);
writeFileSyncSpy.and.callFake((write_path, text, charset) => {
result_json = { write_path: write_path, text: text, charset: charset };
result_json = { write_path, text, charset };
});

let bridgingHeader = new BridgingHeader(dummy_path);
Expand Down Expand Up @@ -90,7 +90,7 @@ describe('unit tests for BridgingHeader module', () => {
readFileSyncSpy.and.callFake((read_path, charset) => bridgingHeaderFileContent);
writeFileSyncSpy.and.callFake((write_path, text, charset) => {
bridgingHeaderFileContent = text;
result_json = { write_path: write_path, text: text, charset: charset };
result_json = { write_path, text, charset };
});

let bridgingHeader = new BridgingHeader(dummy_path);
Expand Down
6 changes: 3 additions & 3 deletions tests/spec/unit/prepare.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ describe('prepare', () => {
describe('launch storyboard feature (CB-9762)', () => {
function makeSplashScreenEntry (src, width, height) {
return {
src: src,
width: width,
height: height
src,
width,
height
};
}

Expand Down

0 comments on commit ea85f74

Please sign in to comment.