lib/cf-resources/api-gateway-resource/apig-utility.js
function(apiId) {
        return module.exports.fetchExistingStages(apiId).then(function(stages) {
            // If there are no stages, then delete the API
            if (!stages || stages.length === 0) {
                return module.exports.deleteAPI(apiId);
            }

            return apiId;
        });
    }
function(apiId) {
        return module.exports.fetchExistingStages(apiId).then(function(stages) {
            // If there are no stages, then delete the API
            if (!stages || stages.length === 0) {
                return module.exports.deleteAPI(apiId);
            }

            return apiId;
        });
    }
function ( apiId ) { return module . exports . fetchExistingStages ( apiId ) . then ( function ( stages ) { // If there are no stages, then delete the API if ( ! stages || stages . length === 0 ) { return module . exports . deleteAPI ( apiId ) ; } return apiId ; } ) ; }
Delete the API if and only if there are no more stages deployed on it

@return {Promise} which resolves to the ID of the API that was deleted
Delete the API if and only if there are no more stages deployed on it