bin/middleware.js
function unsubscribe(topicArn) {

        // if not subscribed then return now
        if (!subscriptions[topicArn]) {
            debug('Not subscribed to ' + topicArn);
            return Promise.resolve();
        }

        return new Promise(function(resolve, reject) {
            const params = { SubscriptionArn: topicArn };
            config.sns.unsubscribe(params, function (err) {
                debug('Unsubscribe from ' + topicArn + (err ? ' failed: ' + err.message : 'succeeded'));
                if (err) return reject(err);
                delete subscriptions[topicArn];
                resolve();
            });
        });
    }
function unsubscribe(topicArn) {

        // if not subscribed then return now
        if (!subscriptions[topicArn]) {
            debug('Not subscribed to ' + topicArn);
            return Promise.resolve();
        }

        return new Promise(function(resolve, reject) {
            const params = { SubscriptionArn: topicArn };
            config.sns.unsubscribe(params, function (err) {
                debug('Unsubscribe from ' + topicArn + (err ? ' failed: ' + err.message : 'succeeded'));
                if (err) return reject(err);
                delete subscriptions[topicArn];
                resolve();
            });
        });
    }
function unsubscribe ( topicArn ) { // if not subscribed then return now if ( ! subscriptions [ topicArn ] ) { debug ( 'Not subscribed to ' + topicArn ) ; return Promise . resolve ( ) ; } return new Promise ( function ( resolve , reject ) { const params = { SubscriptionArn : topicArn } ; config . sns . unsubscribe ( params , function ( err ) { debug ( 'Unsubscribe from ' + topicArn + ( err ? ' failed: ' + err . message : 'succeeded' ) ) ; if ( err ) return reject ( err ) ; delete subscriptions [ topicArn ] ; resolve ( ) ; } ) ; } ) ; }
Unsubscribe from an SNS Topic
@param {string} topicArn
@returns {Promise}
Unsubscribe from an SNS Topic