cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an-s...@apache.org
Subject cordova-lib git commit: CB-10583 Protect plugin preferences from adding extra Array properties. This closes #400
Date Thu, 25 Feb 2016 14:38:37 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master bfea26231 -> d437ae1e4


CB-10583 Protect plugin preferences from adding extra Array properties. This closes #400


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/d437ae1e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/d437ae1e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/d437ae1e

Branch: refs/heads/master
Commit: d437ae1e4240fcb7a98d2833df5d1597ec7f59a8
Parents: bfea262
Author: Vladimir Kotikov <v-vlkoti@microsoft.com>
Authored: Thu Feb 25 11:45:22 2016 +0300
Committer: Vladimir Kotikov <v-vlkoti@microsoft.com>
Committed: Thu Feb 25 17:38:15 2016 +0300

----------------------------------------------------------------------
 cordova-common/src/PluginInfo/PluginInfo.js | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d437ae1e/cordova-common/src/PluginInfo/PluginInfo.js
----------------------------------------------------------------------
diff --git a/cordova-common/src/PluginInfo/PluginInfo.js b/cordova-common/src/PluginInfo/PluginInfo.js
index 2554a3c..e1a1b31 100644
--- a/cordova-common/src/PluginInfo/PluginInfo.js
+++ b/cordova-common/src/PluginInfo/PluginInfo.js
@@ -43,18 +43,14 @@ function PluginInfo(dirname) {
     // <preference> tag
     // Example: <preference name="API_KEY" />
     // Used to require a variable to be specified via --variable when installing the plugin.
+    // returns { key : default | null}
     self.getPreferences = getPreferences;
     function getPreferences(platform) {
-        var arprefs = _getTags(self._et, 'preference', platform, _parsePreference);
-
-        var prefs= {};
-        for(var i in arprefs)
-        {
-            var pref=arprefs[i];
-            prefs[pref.preference]=pref.default;
-        }
-        // returns { key : default | null}
-        return prefs;
+        return _getTags(self._et, 'preference', platform, _parsePreference)
+        .reduce(function (preferences, pref) {
+            preferences[pref.preference] = pref.default;
+            return preferences;
+        }, {});
     }
 
     function _parsePreference(prefTag) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message