Is there a better way to do this (clean, efficient, good practices)?import aws from 'aws-sdk'aws.config.setPromisesDependency(require('bluebird'))ebs.describeApplications().promise()  .then(({ Applications }) => Applications.map(app => { return { ...app, Environments: [] }}))  .each(app => {    return ebs.describeEnvironments({ ApplicationName: app.ApplicationName }).promise()      .then(({ Environments }) => app.Environments = Environments)      .catch(error => { throw error })  })  .then(applications => {    console.log(applications)  })  .catch(error => console.error(error))It works but it feels wrong to me.Here is a sample of a return from each calls:describeApplications:{    Applications: [        {            ApplicationName: test-application,             Versions: [                Sample Application            ],             DateCreated: 2017-02-05T03:39:41.144Z,             ConfigurationTemplates: [],             DateUpdated: 2017-02-05T03:39:41.144Z,             ResourceLifecycleConfig: {                VersionLifecycleConfig: {                    MaxCountRule: {                        DeleteSourceFromS3: false,                         Enabled: false,                         MaxCount: 200                    },                     MaxAgeRule: {                        DeleteSourceFromS3: false,                         Enabled: false,                         MaxAgeInDays: 180                    }                }            }        }    ]}describeEnvironments:{    Environments: [        {            ApplicationName: test-application,             EnvironmentName: Sample-env,             VersionLabel: Sample Application,             Status: Ready,             EnvironmentLinks: [],             EnvironmentId: ********,             EndpointURL: ********,             SolutionStackName: 64bit Amazon Linux 2016.09 v2.5.0 running Docker 1.12.6,             CNAME: ********,             Health: Green,             AbortableOperationInProgress: false,             Tier: {                Version:  ,                 Type: Standard,                 Name: WebServer            },             HealthStatus: Ok,             DateUpdated: 2017-02-05T03:46:17.325Z,             DateCreated: 2017-02-05T03:39:46.072Z        }    ]}And the results of my code:[{    ApplicationName: 'test-application',    DateCreated: 2017 - 02 - 05 T03: 39: 41.144 Z,    DateUpdated: 2017 - 02 - 05 T03: 39: 41.144 Z,    Versions: ['Sample Application'],    ConfigurationTemplates: [],    ResourceLifecycleConfig: {        VersionLifecycleConfig: {            MaxCountRule: {                Enabled: false,                MaxCount: 200,                DeleteSourceFromS3: false            },            MaxAgeRule: {                Enabled: false,                MaxAgeInDays: 180,                DeleteSourceFromS3: false            }        }    },    Environments: [{        EnvironmentName: 'Sample-env',        EnvironmentId: '********',        ApplicationName: 'test-application',        VersionLabel: 'Sample Application',        SolutionStackName: '64bit Amazon Linux 2016.09 v2.5.0 running Docker 1.12.6',        EndpointURL: '********',        CNAME: '********',        DateCreated: 2017 - 02 - 05 T03: 39: 46.072 Z,        DateUpdated: 2017 - 02 - 05 T03: 46: 17.325 Z,        Status: 'Ready',        AbortableOperationInProgress: false,        Health: 'Green',        HealthStatus: 'Ok',        Tier: {            Name: 'WebServer',            Type: 'Standard',            Version: ''        },        EnvironmentLinks: []    }]}]
Chaining multiple async calls and data manipulation within promises
javascript;node.js;promise