breautek commented on code in PR #1406:
URL: https://github.com/apache/cordova-ios/pull/1406#discussion_r1516638428


##########
lib/PlatformConfigParser.js:
##########
@@ -0,0 +1,35 @@
+/**
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+*/
+
+'use strict';
+
+const ConfigParser = require('cordova-common').ConfigParser;
+
+class PlatformConfigParser extends ConfigParser {
+    /** getPrivacyManifest */
+    getPrivacyManifest () {
+        const platform_manifest = 
this.doc.find('./platform[@name="ios"]/privacy-manifest');
+        if (platform_manifest != null) {
+            return platform_manifest;
+        }
+        return null;
+    }

Review Comment:
   I think the condition here is redundent.
   
   We are:
   
   1. creating a variable without making any use of it,
   2. checking if it's not null and returning it
   3. Otherwise returning null, which is the value of said variable if it 
reached this point.
   
   I think we can simplify it just simply returning the result of 
`this.doc.find(...)`.
   
   If we want to make it clear that null can be returned, we can perhaps add a 
JSDoc
   
   ```suggestion
       /**
        * Returns the privacy manifest node, if available.
        * Otherwise `null` is returned.
        */
       getPrivacyManifest () {
           return this.doc.find('./platform[@name="ios"]/privacy-manifest');
       }
   ```
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to