This is an automated email from the ASF dual-hosted git repository.

erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-electron.git


The following commit(s) were added to refs/heads/master by this push:
     new 116825f  refactor: transform for (#124)
116825f is described below

commit 116825fa2633fb0e26185734206c06c139127959
Author: エリス <[email protected]>
AuthorDate: Fri Dec 20 07:00:59 2019 +0900

    refactor: transform for (#124)
---
 bin/templates/cordova/lib/prepare.js | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/bin/templates/cordova/lib/prepare.js 
b/bin/templates/cordova/lib/prepare.js
index 5c15560..5be77ea 100644
--- a/bin/templates/cordova/lib/prepare.js
+++ b/bin/templates/cordova/lib/prepare.js
@@ -128,10 +128,8 @@ function prepareSplashScreens (splashScreens) {
     };
 
     // iterate over remaining icon elements to find the icons for the app and 
installer
-    for (let i = 0; i < splashScreens.length; i++) {
-        const image = splashScreens[i];
+    for (const image of splashScreens) {
         image.extension = path.extname(image.src);
-
         splashScreen = splashScreen ? chooseOne(splashScreen, image) : image;
     }
 
@@ -144,14 +142,13 @@ function prepareSplashScreens (splashScreens) {
 function updatePathToSplashScreen (config, locations, resourceMap) {
     const elementKeys = Object.keys(resourceMap[0]);
     const splashScreenPath = resourceMap[0][elementKeys];
-
     const splash = config.doc.find('splash');
     const preferences = config.doc.findall('preference');
 
     splash.attrib.src = path.relative(locations.www, splashScreenPath);
-    for (let i = 0; i < preferences.length; i++) {
-        if (preferences[i].attrib.name === 'SplashScreen') {
-            preferences[i].attrib.value = splash.attrib.src;
+    for (const preference of preferences) {
+        if (preference.attrib.name === 'SplashScreen') {
+            preference.attrib.value = splash.attrib.src;
         }
     }
     config.write();
@@ -212,14 +209,11 @@ function prepareIcons (icons) {
 
     // find if there is high resolution images that has DPI suffix
     const highResAndRemainingIcons = findHighResIcons(icons);
-
     const highResIcons = highResAndRemainingIcons.highResIcons;
     const remainingIcons = highResAndRemainingIcons.remainingIcons;
 
     // iterate over remaining icon elements to find the icons for the app and 
installer
-    for (let i = 0; i < remainingIcons.length; i++) {
-        // if (fs.existsSync(icons[i].src)) {
-        const icon = remainingIcons[i];
+    for (const icon of remainingIcons) {
         const size = icon.width || icon.height;
         icon.extension = path.extname(icon.src);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to