/**
    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.
*/

var cordova_util = require('./util');
var Q = require('q');
var CordovaError = require('cordova-common').CordovaError;
var knownPlatforms = require('../platforms/platforms');

/**
 * Runs requirements check against platforms specified in 'platfoms' argument
 *
 * @param  {String[]} platforms List of platforms for requirements check. If
 *   none, all platforms, added to project will be checked
 *
 * @return {Promise<Object>}    Promise fullfilled with map of platforms and
 *   requirements check results for each platform.
 */
module.exports = function check_reqs (platforms) {
    return Promise.resolve().then(function () {
        var platforms = cordova_util.preProcessOptions(platforms).platforms; // eslint-disable-line no-use-before-define

        return Q.allSettled(platforms.map(function (platform) {
            return knownPlatforms.getPlatformApi(platform).requirements();
        })).then(function (settledChecks) {
            var res = {};
            settledChecks.reduce(function (result, settledCheck, idx) {
                var platformName = platforms[idx];
                result[platformName] = settledCheck.state === 'fulfilled' ?
                    settledCheck.value :
                    new CordovaError(settledCheck.reason);
                return result;
            }, res);
            return res;
        });
    });
};

@@ -814,71 +814,117 @@
 */%0A%0A
-var cordova_util = require('./util');%0Avar Q = require('q');%0Avar
+const %7B object: zipObject %7D = require('underscore');%0Aconst %7B preProcessOptions %7D = require('./util');%0Aconst %7B
  Cor
@@ -932,16 +932,18 @@
 ovaError
+ %7D
  = requi
@@ -966,26 +966,15 @@
 on')
-.CordovaError;%0Avar
+;%0Aconst
  kno
@@ -1468,207 +1468,120 @@
 hen(
-function () %7B%0A        var platforms = cordova_util.preProcessOptions(platforms).platforms; // eslint-disable-line no-use-before-define%0A%0A        return Q.allSettled(platforms.map(function (platform) %7B
+() =%3E %7B%0A        const normalizedPlatforms = preProcessOptions(platforms).platforms;%0A%0A        return Promise.all(
 %0A   
@@ -1593,20 +1593,18 @@
     
-return known
+normalized
 Plat
@@ -1609,16 +1609,20 @@
 atforms.
+map(
 getPlatf
@@ -1628,23 +1628,9 @@
 form
-Api(platform).r
+R
 equi
@@ -1640,11 +1640,16 @@
 ents
-();
+OrError)
 %0A   
@@ -1657,464 +1657,261 @@
     
-%7D)
 ).then(
-function (settledChecks) %7B%0A            var res = %7B%7D;%0A            settledChecks.reduce(function (result, settledCheck, idx) %7B%0A                var platformName = platforms%5Bidx%5D;%0A                result%5BplatformName%5D = settledCheck.state === 'fulfilled' ?%0A                    settledCheck.value :%0A                    new CordovaError(settledCheck.reason);%0A                return result;%0A            %7D, res);%0A            return res;%0A        %7D);%0A    %7D
+results =%3E zipObject(normalizedPlatforms, results));%0A    %7D);%0A%7D;%0A%0Afunction getPlatformRequirementsOrError (platform) %7B%0A    return knownPlatforms%0A        .getPlatformApi(platform)%0A        .requirements()%0A        .catch(err =%3E new CordovaError(err)
 );%0A%7D
-;
 %0A

Rewrite cordova/requirements to get rid of `Q.allSettled`